Conditions | 3 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
30 | public function after($callback) |
||
31 | { |
||
32 | if (is_string($callback)) { |
||
33 | $callback = ControllerContainer::resolveController($callback); |
||
34 | } |
||
35 | |||
36 | $this->on('after', function ($request, $response) use (&$callback) { |
||
37 | try { |
||
38 | call_user_func_array($callback, func_get_args()); |
||
39 | } catch (\Exception $e) { |
||
40 | $this->emit('error', [$request, $response, $e->getMessage()]); |
||
41 | } |
||
42 | }); |
||
43 | } |
||
44 | } |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.