PHP_CodeSniffer_File::_createScopeMap PHP Méthode

_createScopeMap() private static méthode

Creates a scope map of tokens that open scopes.
See also: _recurseScopeMap()
private static _createScopeMap ( array &$tokens, object $tokenizer, string $eolChar ) : void
$tokens array The array of tokens to process.
$tokenizer object The tokenizer being used to process this file.
$eolChar string The EOL character to use for splitting strings.
Résultat void
    private static function _createScopeMap(&$tokens, $tokenizer, $eolChar)
    {
        if (PHP_CODESNIFFER_VERBOSITY > 1) {
            echo "\t*** START SCOPE MAP ***" . PHP_EOL;
        }
        $numTokens = count($tokens);
        for ($i = 0; $i < $numTokens; $i++) {
            // Check to see if the current token starts a new scope.
            if (isset($tokenizer->scopeOpeners[$tokens[$i]['code']]) === true) {
                if (PHP_CODESNIFFER_VERBOSITY > 1) {
                    $type = $tokens[$i]['type'];
                    $content = PHP_CodeSniffer::prepareForOutput($tokens[$i]['content']);
                    echo "\tStart scope map at {$i}:{$type} => {$content}" . PHP_EOL;
                }
                if (isset($tokens[$i]['scope_condition']) === true) {
                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
                        echo "\t* already processed, skipping *" . PHP_EOL;
                    }
                    continue;
                }
                $i = self::_recurseScopeMap($tokens, $numTokens, $tokenizer, $eolChar, $i);
            }
            //end if
        }
        //end for
        if (PHP_CODESNIFFER_VERBOSITY > 1) {
            echo "\t*** END SCOPE MAP ***" . PHP_EOL;
        }
    }