Ejemplo n.º 1
0
 /**
  * Handle onBefore, onAfter and name
  *
  * @param mixed $offset The name of the variable
  * @param mixed $value  The value
  *
  * @return void
  */
 public function offsetSet($offset, $value)
 {
     if ($offset === 'onBefore' || $offset == 'onAfter') {
         $type = lcfirst(substr($offset, 2));
         $name = $this->offsetGet('name');
         $factory = $this->console->getFactory();
         foreach ((array) $this->expand($value) as $subTask) {
             $subTask = $factory->createTask($this->expand($subTask), $this, [$type => $name]);
             $this->job->addTask($subTask);
         }
     }
     if ($offset === 'name' && parent::offsetGet('name')) {
         throw new Exception('name may not be set doubly (try putting it at top of the task/job/workflow configuration');
     }
     parent::offsetSet($offset, $value);
 }
Ejemplo n.º 2
0
 /**
  * Create and return the job
  *
  * @return Job
  */
 public function getJob()
 {
     if (!$this->job) {
         $this->job = $this->console->getFactory()->createJob($this->getName());
     }
     return $this->job;
 }