Пример #1
0
 /**
  * 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;
 }
Пример #2
0
 /**
  * Initialises this request object.
  * @param $get is a GET associative array.
  * @param $post is a POST associative array.
  * @param $sec is an instance of assegai's security class: \assegai\Security.
  */
 function __construct()
 {
     parent::__construct();
     $this->getvars = array();
     $this->postvars = array();
 }
Пример #3
0
 /**
  * Apply Transition
  *
  * @param mixed    $input
  * @param Stateful $context
  * @param Runner   $runner
  *
  * @return mixed
  */
 public function apply($input, Stateful $context, Runner $runner)
 {
     $context->setCurrentState($this->to);
     if ($this->action !== null && is_callable($this->action)) {
         return call_user_func($this->action, $input, $context, $runner, $this);
     }
     if ($input instanceof InputSequence) {
         $input->pop();
     }
     return $this->action ?: $this->to;
 }
Пример #4
0
 function __get($k)
 {
     $t = $this;
     $t->load();
     return ($m = v($t::$r[$k])) ? current($t->{$k}(array(), 1)) : (($m = v($t::$b[$k])) ? new $m($t->d[$m::$f]) : parent::__get($k));
 }