| Conditions | 3 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | public function after($callback) |
||
| 16 | { |
||
| 17 | if (is_string($callback)) { |
||
| 18 | $callback = ControllerContainer::resolveController($callback); |
||
| 19 | } |
||
| 20 | |||
| 21 | $this->on('after', function ($request, $response) use (&$callback) { |
||
|
|
|||
| 22 | try { |
||
| 23 | call_user_func_array($callback, func_get_args()); |
||
| 24 | } catch (\Execption $e) { |
||
| 25 | $this->emit('error', [$request, $response, $e->getMessage()]); |
||
| 26 | } |
||
| 27 | }); |
||
| 28 | } |
||
| 29 | } |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idableprovides a methodequalsIdthat in turn relies on the methodgetId(). If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()as an abstract method to the trait will make sure it is available.