Change code style to PSR-2

Reviewed the code and change coding style to PSR-2 (used PHP_CodeSniffer for validation) also fix some small issue related to not defined variable or missing function parameters.
Found it :)

@GM-Alex why logger is bein overrided to null? I don't get it. Also, this is happening at other parts that are not covered by the unit tests, so I'm afraid this PR might have introduced some silent bugs. Hope not :)

@c9s What should we do?

@GM-Alex, @c9s I was being very cautious (and slow) trying to avoid this kind of commit that correct things everywhere (except for code formatting) because we have a very small test coverage. Let's consider we were lucky to catch this fail because `ExtCommand` was added two commits ago.

If we are going to correct something let's add a test for each affected method / class as much as possible.