Insight/CS improvments

A range of refactorings based on Insight analysis and PHPCS violations.

https://insight.sensiolabs.com/projects/558bf848-19cc-4e6e-82de-9044c573e3a3/analyses/5