/** * Accept * * Has the FSM reached a terminal state with all input consumed? * * @return bool */ private function accept() { if ($this->context->getCurrentState()->isTerminal() && count($this->input) == 0) { return true; } return false; }