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

Breadcrumb

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

function Scanner::consume

Same name in this branch
  1. 11.1.x vendor/masterminds/html5/src/HTML5/Parser/Scanner.php \Masterminds\HTML5\Parser\Scanner::consume()

Checks if the given string is matched, if so it consumes the token

Parameters

string $expected String to check:

Return value

Token|null

File

vendor/mck89/peast/lib/Peast/Syntax/Scanner.php, line 695

Class

Scanner
Base class for scanners.

Namespace

Peast\Syntax

Code

public function consume($expected) {
    
    //Do not call getToken if there's already a pending token for
    
    //performance reasons
    $token = $this->currentToken ?: $this->getToken();
    if ($token && $token->value === $expected) {
        $this->consumeToken();
        return $token;
    }
    return null;
}

API Navigation

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