phpcsmw fixes

* phpcs (with MW config) fixes.
* Removed duplicate code.
* Removed whitespace, tabs when not needed.