CS Fix: string access and guard clauses

In order to pass build (on master) we need to use brackes for string access ([as suggested by php doc](http://php.net/manual/en/language.types.string.php#language.types.string.substr)), and guard clause instead of conditional nesting for specific class declaration.