Пример #1
0
 /**
  * Run the condition using the values from the condition model
  *
  * @param Bag $bag Traveler bag object with data from the pipeline
  *
  * @return boolean
  */
 protected function runCondition(Bag $bag)
 {
     $fieldValue = $bag->lookAt($this->condition->field);
     $operator = $this->condition->operator;
     if ($this->checkEqualsAndNotEquals($operator, $fieldValue)) {
         return true;
     }
     if ($this->checkGreaterAndLessThan($operator, $fieldValue)) {
         return true;
     }
     return false;
 }
Пример #2
0
 /**
  * Processes the action
  *
  * @param Bag $bag Travelers Bag object
  *
  * @return boolean
  */
 public function processAction(Bag $bag)
 {
     $type = $this->action->type;
     /** @var \App\Pipeline\Execution\Manager $executorManager */
     $executorManager = app('ExecutorManager');
     $executor = $executorManager->getByType($type);
     if ($executor === null) {
         return false;
     }
     $output = $executor->execute($this->action);
     if ($output === false) {
         return false;
     }
     $bag->give($output, 'ExecutorOutput');
     return true;
 }
Пример #3
0
 /**
  * Restore the instance after serialization.
  *
  * @return void
  */
 public function __wakeup()
 {
     $this->bag->unserialize();
     $this->previousPipes = array_map(function ($pipeIdentifier) {
         return PipeFactory::makeFromPipeIdentifier($pipeIdentifier);
     }, $this->previousPipes);
     $this->nextPipe = PipeFactory::makeFromPipeIdentifier($this->nextPipe);
     $progressModelIdentifier = $this->progress;
     $this->progress = (new $progressModelIdentifier->class())->findOrFail($progressModelIdentifier->id);
 }