| Conditions | 7 |
| Paths | 24 |
| Total Lines | 30 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 2 | Features | 2 |
| 1 | <?php |
||
| 6 | public function execute(array $arguments) |
||
| 7 | { |
||
| 8 | $actionName = (isset($arguments[0]) ? $arguments[0] : null); |
||
| 9 | $parameters = (isset($arguments[1]) ? $arguments[1] : array()); |
||
| 10 | |||
| 11 | if (empty($actionName)) { |
||
| 12 | throw new Exception(sprintf('Empty action name')); |
||
| 13 | } |
||
| 14 | |||
| 15 | if (!is_array($parameters)) { |
||
| 16 | throw new Exception(sprintf('Parameters should be an array')); |
||
| 17 | } |
||
| 18 | |||
| 19 | $context = $this->getViewHelperService()->getContext()->newParent(); |
||
| 20 | $context->setActionName($actionName); |
||
| 21 | |||
| 22 | foreach ($parameters as $key => $value) { |
||
| 23 | $context->getRequest()->query->set($key, $value); |
||
| 24 | } |
||
| 25 | |||
| 26 | $result = $this->getViewHelperService() |
||
| 27 | ->getApplication() |
||
| 28 | ->runAction($context); |
||
| 29 | |||
| 30 | if ($context->getResponse() instanceof \Symfony\Component\HttpFoundation\Response) { |
||
| 31 | return $context->getResponse()->getContent(); |
||
| 32 | } |
||
| 33 | |||
| 34 | return $result; |
||
| 35 | } |
||
| 36 | } |