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

Breadcrumb

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

function ParserAbstract::getAttributes

Get attributes for a node with the given start and end token positions.

Parameters

int $tokenStartPos Token position the node starts at:

int $tokenEndPos Token position the node ends at:

Return value

array<string, mixed> Attributes

3 calls to ParserAbstract::getAttributes()
ParserAbstract::getAttributesAt in vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php
Get combined start and end attributes at a stack location
ParserAbstract::getAttributesForToken in vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php
Get attributes for a single token at the given token position.
ParserAbstract::maybeCreateNop in vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php

File

vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php, line 481

Class

ParserAbstract

Namespace

PhpParser

Code

protected function getAttributes(int $tokenStartPos, int $tokenEndPos) : array {
    $startToken = $this->tokens[$tokenStartPos];
    $afterEndToken = $this->tokens[$tokenEndPos + 1];
    return [
        'startLine' => $startToken->line,
        'startTokenPos' => $tokenStartPos,
        'startFilePos' => $startToken->pos,
        'endLine' => $afterEndToken->line,
        'endTokenPos' => $tokenEndPos,
        'endFilePos' => $afterEndToken->pos - 1,
    ];
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal