Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Tokenizer.php

function Tokenizer::createScopeMap

Creates a scope map of tokens that open scopes.

Return value

void

See also

recurseScopeMap()

1 call to Tokenizer::createScopeMap()
Tokenizer::__construct in vendor/squizlabs/php_codesniffer/src/Tokenizers/Tokenizer.php
Initialise and run the tokenizer.

File

vendor/squizlabs/php_codesniffer/src/Tokenizers/Tokenizer.php, line 892

Class

Tokenizer

Namespace

PHP_CodeSniffer\Tokenizers

Code

private function createScopeMap() {
    if (PHP_CODESNIFFER_VERBOSITY > 1) {
        echo "\t*** START SCOPE MAP ***" . PHP_EOL;
    }
    for ($i = 0; $i < $this->numTokens; $i++) {
        // Check to see if the current token starts a new scope.
        if (isset($this->scopeOpeners[$this->tokens[$i]['code']]) === true) {
            if (PHP_CODESNIFFER_VERBOSITY > 1) {
                $type = $this->tokens[$i]['type'];
                $content = Common::prepareForOutput($this->tokens[$i]['content']);
                echo "\tStart scope map at {$i}:{$type} => {$content}" . PHP_EOL;
            }
            if (isset($this->tokens[$i]['scope_condition']) === true) {
                if (PHP_CODESNIFFER_VERBOSITY > 1) {
                    echo "\t* already processed, skipping *" . PHP_EOL;
                }
                continue;
            }
            $i = $this->recurseScopeMap($i);
        }
        
        //end if
    }
    
    //end for
    if (PHP_CODESNIFFER_VERBOSITY > 1) {
        echo "\t*** END SCOPE MAP ***" . PHP_EOL;
    }
}
RSS feed
Powered by Drupal