/** * @see ExecutableInterface::execute() */ public function execute() { if (!$this->started) { throw new \Exception('UnitProcedure not started'); } if (!$this->getCurrentOperation()) { $this->setFinished(); return; } // Start the next Operation? if ($this->getCurrentOperation()->isFinished()) { // Go to next unit procedure if possible if ($this->operations->next()) { $operation = $this->getCurrentOperation(); $operation->setEventDispatcher($this->eventDispatcher); $operation->start(); } else { // If last operation is finished // set the finished flag $this->setFinished(); } } // Execute if (!$this->finished && $this->getCurrentOperation()->isStarted()) { // Perform Operation $this->getCurrentOperation()->execute(); } }