public function match(SequenceInterface $sequence) { while (!$sequence->endOfSequence()) { $sequence->next(); $this->tokens[] = $sequence->current(); } }
public function match(SequenceInterface $sequence) { $occurrences = 0; while (!$sequence->endOfSequence()) { try { $this->innerExpectation->match($sequence); //$sequence->next(); $occurrences++; } catch (ExpectationNotMatched $exception) { break; } } $this->matchOccurrences($occurrences); }
public function match(SequenceInterface $sequence) { if ($sequence->endOfSequence()) { throw new ExpectationNotMatched(); } $nextToken = $sequence->peek(); if ($nextToken['code'] === $this->code) { if ($this->content === null || $this->content === $nextToken['content']) { $sequence->next(); return; } } throw new ExpectationNotMatched(); }