fix coding style issues

I ran phpcs with standard PSR2 and fixed all issues introduced by me or in
files touched by me. There are however still many issues in other files.
I also fixed the issues outlined in the line comments in my first PR.