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;
} /**
* Checks if one of the given strings is matched, if so it consumes the
* token
*
* @param array $expected Strings to check
*
* @return Token|null
*/