PhpCsFixer\Fixer\LanguageConstruct\ClassKeywordRemoveFixer::replaceClassKeyword PHP Method

replaceClassKeyword() private method

private replaceClassKeyword ( Tokens $tokens, integer $classIndex )
$tokens PhpCsFixer\Tokenizer\Tokens
$classIndex integer
    private function replaceClassKeyword(Tokens $tokens, $classIndex)
    {
        $classEndIndex = $classIndex - 2;
        $classBeginIndex = $classEndIndex;
        while ($tokens[--$classBeginIndex]->isGivenKind(array(T_NS_SEPARATOR, T_STRING))) {
        }
        ++$classBeginIndex;
        $classString = $tokens->generatePartialCode($classBeginIndex, $classEndIndex);
        $classImport = false;
        foreach ($this->imports as $alias => $import) {
            if ($classString === $alias) {
                $classImport = $import;
                break;
            }
            $classStringArray = explode('\\', $classString);
            $namespaceToTest = $classStringArray[0];
            if (0 === strcmp($namespaceToTest, substr($import, -strlen($namespaceToTest)))) {
                $classImport = $import;
                break;
            }
        }
        $tokens->clearRange($classBeginIndex, $classIndex);
        $tokens->insertAt($classBeginIndex, new Token(array(T_CONSTANT_ENCAPSED_STRING, "'" . $this->makeClassFQN($classImport, $classString) . "'")));
    }