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

Breadcrumb

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

function Fixer::substrToken

Replace the content of a token with a part of its current content.

Parameters

int $stackPtr The position of the token in the token stack.:

int $start The first character to keep.:

int $length The number of characters to keep. If NULL, the content of: the token from $start to the end of the content is kept.

Return value

bool If the change was accepted.

File

vendor/squizlabs/php_codesniffer/src/Fixer.php, line 707

Class

Fixer

Namespace

PHP_CodeSniffer

Code

public function substrToken($stackPtr, $start, $length = null) {
    $current = $this->getTokenContent($stackPtr);
    if ($length === null) {
        $newContent = substr($current, $start);
    }
    else {
        $newContent = substr($current, $start, $length);
    }
    return $this->replaceToken($stackPtr, $newContent);
}
RSS feed
Powered by Drupal