Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Prepare arguments for execution (prepend : so Auryn DI does not resolve them)
- $actionArguments = array();
- foreach ($router->currentRoute->getParams() as $key => $value) {
- $actionArguments[sprintf(':%s', $key)] = $value;
- }
- // Call the controller object itself as a second constructor (__invoke() method)
- if (is_callable($controller)) {
- $injector->execute($controller);
- }
- try {
- $result = $injector->execute(array($controller, $callable[1]), $actionArguments);
- } catch (\Exception $e) {
- $result = json_encode(array('error' => $e->getMessage()));
- $response->setStatusCode(200);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement