Formatting fixes

I opened the project file per file to figure out how it works and I reformatted some parts of code according to the php-fig standards.
I also updated the .gitignore to ignore .DS_Store files (typical of mac users) and to ignore IntelliJ platform (Idea, PhpStorm) project specific files.