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

Breadcrumb

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

function PHP::createAttributesNestingMap

Creates a map for the attributes tokens that surround other tokens.

Return value

void

1 call to PHP::createAttributesNestingMap()
PHP::processAdditional in vendor/squizlabs/php_codesniffer/src/Tokenizers/PHP.php
Performs additional processing after main tokenizing.

File

vendor/squizlabs/php_codesniffer/src/Tokenizers/PHP.php, line 3970

Class

PHP

Namespace

PHP_CodeSniffer\Tokenizers

Code

private function createAttributesNestingMap() {
    $map = [];
    for ($i = 0; $i < $this->numTokens; $i++) {
        if (isset($this->tokens[$i]['attribute_opener']) === true && $i === $this->tokens[$i]['attribute_opener']) {
            if (empty($map) === false) {
                $this->tokens[$i]['nested_attributes'] = $map;
            }
            if (isset($this->tokens[$i]['attribute_closer']) === true) {
                $map[$this->tokens[$i]['attribute_opener']] = $this->tokens[$i]['attribute_closer'];
            }
        }
        else {
            if (isset($this->tokens[$i]['attribute_closer']) === true && $i === $this->tokens[$i]['attribute_closer']) {
                array_pop($map);
                if (empty($map) === false) {
                    $this->tokens[$i]['nested_attributes'] = $map;
                }
            }
            else {
                if (empty($map) === false) {
                    $this->tokens[$i]['nested_attributes'] = $map;
                }
            }
        }
        
        //end if
    }
    
    //end for
}
RSS feed
Powered by Drupal