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
Namespace
PHP_CodeSniffer\TokenizersCode
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
}