PHPCS update.

Hi,

Here is an pull request to fix PHPCS errors and decrease number of nested levels.
I made the modifications as safe as possible.