Conditions | 2 |
Paths | 2 |
Total Lines | 19 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
31 | public function invoke( |
||
32 | ControllerInterface $controller, |
||
33 | ControllerDispatch $dispatch |
||
34 | ) |
||
35 | { |
||
36 | $reflection = new \ReflectionClass($controller); |
||
37 | |||
38 | if (!$reflection->hasMethod($dispatch->getMethod())) { |
||
39 | throw new UndefinedControllerMethodException( |
||
40 | "The controller '{$dispatch->getControllerClassName()}' does ". |
||
41 | "not have a method called '{$dispatch->getMethod()}'." |
||
42 | ); |
||
43 | } |
||
44 | |||
45 | $method = $reflection->getMethod($dispatch->getMethod()); |
||
46 | $method->invokeArgs($controller, $dispatch->getArguments()); |
||
47 | |||
48 | return $controller->getViewData(); |
||
49 | } |
||
50 | } |