improve readability of code

* coding style fixes
* some PHPStorm code inspection fixes
* few method extractions
* removed unused methods
* whitespace fixes

 all as part of our code cleanup strategy and to make code better readable.
true, one return is better. BTW: as I mentioned it is also about better debugging here not only about readability.
Not using ternary syntax usually allows you to quicker read/understand the code as it is harder to parse (in my head) when having a look at the whole file etc (at least for me)