public function handle(RequestInterface $request, ParametersInterface $configuration, ContextInterface $context) { $yaml = new Parser(); $process = $yaml->parse($configuration->get('process')); $repository = new MemoryRepository(); $id = 1; if (is_array($process)) { foreach ($process as $class => $config) { if (is_array($config)) { $config = array_map('strval', $config); if (isset($config['id'])) { $name = $config['id']; unset($config['id']); } else { $name = 'action-' . $id; } $action = new Action(); $action->setId($id); $action->setName($name); $action->setClass($class); $action->setConfig($config); $action->setDate(date('Y-m-d H:i:s')); $repository->add($action); $id++; } } } if ($id === 1) { throw new ConfigurationException('No process defined'); } $this->processor->push($repository); try { $return = $this->processor->execute(1, $request, $context); $this->processor->pop(); return $return; } catch (\Exception $e) { $this->processor->pop(); throw $e; } }