CS fixes

Most fixes have been done using the PHP-CS-Fixer tool. A few others are about fixing the phpdoc based on Scrutinizer suggestions and issues
I added the implements clause here, because it actually implements the main method of the interface (with abstract protected methods for parts of the implementation)