Total Complexity | 4 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
19 | trait CallableTrait |
||
20 | { |
||
21 | /** @var callable|null */ |
||
22 | protected $callable = null; |
||
23 | |||
24 | protected function handleCallable($object) |
||
25 | { |
||
26 | if (is_null($this->callable)) { |
||
27 | throw new \Error("Undefined Callable"); |
||
28 | } |
||
29 | return call_user_func($this->callable, $object); |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * @return callable|null |
||
34 | */ |
||
35 | public function getCallable() |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @param callable $callable |
||
42 | * @return self |
||
43 | */ |
||
44 | public function setCallable(callable $callable) : self |
||
48 | } |
||
49 | } |
||
50 |