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

Breadcrumb

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

function Scanner::consumeOneOf

Checks if one of the given strings is matched, if so it consumes the token

Parameters

array $expected Strings to check:

Return value

Token|null

File

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

Class

Scanner
Base class for scanners.

Namespace

Peast\Syntax

Code

public function consumeOneOf($expected) {
    
    //Do not call getToken if there's already a pending token for
    
    //performance reasons
    $token = $this->currentToken ?: $this->getToken();
    if ($token && in_array($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