Пример #1
0
 public function execute(ActionInterface $action)
 {
     $action->execute();
     $this->getQueue()->deleteMessage($action->getQueueItem());
     if ($this->getQueue()->count() == 0) {
         $this->finish();
     }
 }
Пример #2
0
 /**
  * カウントアップ
  */
 public function countUp()
 {
     for ($i = 1; $i <= $this->maxNum; $i++) {
         if ($this->rule->isAho($i)) {
             $this->action->actAsAho($i);
         } else {
             $this->action->actAsNormal($i);
         }
     }
 }
Пример #3
0
 /**
  * Extend an action by appending additional logic
  *
  * Note that this modifies the original action as opposed to creating a new action.
  * The action returned will be the same one you called `extend()` on but will have a
  * modified operation and dependencies.
  *
  * @access public
  * @param ActionInterface $action The action with which to extend this one
  * @return Action the extended action
  */
 public function extend(ActionInterface $action)
 {
     $principal = $this->getOperation();
     $extension = $action->getOperation();
     $this->dependencies = array_unique(array_merge($this->getDependencies(), $action->getDependencies()));
     $this->operation = function () use($principal, $extension) {
         call_user_func_array($principal, func_get_args());
         call_user_func_array($extension, func_get_args());
     };
     return $this;
 }
Пример #4
0
 /**
  * @param ActionInterface $action
  * @return $this
  */
 public function addAction(ActionInterface $action)
 {
     $actions = $this->getActions();
     $action->setRule($this->getRule());
     $actions[] = $action;
     if (!$action->getId()) {
         $action->setId($this->getId() . '.' . sizeof($actions));
     }
     $this->setActions($actions);
     return $this;
 }
Пример #5
0
 public function execute(ActionInterface $action)
 {
     $action->execute();
 }
Пример #6
0
 /**
  * @param ActionInterface $action
  * @param bool            $throwsException
  *
  * @return array|false
  * @throws \Exception
  */
 public function call(ActionInterface $action, $throwsException = true)
 {
     try {
         $this->checkSecurity();
         $result = $this->soapClient->call($this->sessionId, $action->getMethod(), $action->getArguments());
         return $result;
     } catch (\Exception $e) {
         if ($throwsException) {
             throw $e;
         }
         return false;
     }
 }
 /**
  * Adds an action.
  *
  * @param ActionInterface $action The action.
  */
 public function add(ActionInterface $action)
 {
     $this->actions[$action->getFullName()] = $action;
 }
    /**
     * Adds an action.
     *
     * @param ActionInterface $action An action.
     *
     * @throws \LogicException If the action is already in the collection.
     */
    public function add(ActionInterface $action)
    {
        if (isset($this->actions[$action->getFullName()])) {
            throw new \LogicException(sprintf('The action "%s" already exists.', $action->getFullName()));
        }

        $this->actions[$action->getFullName()] = $action;
    }