Example #1
0
 /**
  * @param mixed|null $payload
  * @return mixed|null
  */
 public function process($payload = null)
 {
     if (empty($this->stages)) {
         return null;
     }
     // Call all stages which depend only on the input
     $graph = new Graph($this->stages, new Sequential());
     $results = $graph->process($payload);
     end($this->stages);
     $lastStageIndex = key($this->stages);
     reset($this->stages);
     return $results->output($lastStageIndex);
 }