Total Complexity | 8 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Coverage | 92.31% |
Changes | 0 |
1 | <?php |
||
7 | class HeyMan |
||
8 | { |
||
9 | 15 | public function turnOff(): Consider |
|
10 | { |
||
11 | 15 | return new Consider('turnOff'); |
|
12 | } |
||
13 | |||
14 | 1 | public function turnOn(): Consider |
|
17 | } |
||
18 | |||
19 | 13 | public function forget(): Forget |
|
22 | } |
||
23 | |||
24 | 102 | public function __call($method, $args) |
|
25 | { |
||
26 | 102 | $this->writeDebugInfo(debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2)); |
|
27 | 102 | ||
28 | 102 | foreach ($this->situations() as $className) { |
|
29 | if (method_exists($className, $method)) { |
||
30 | return app($className)->$method(...$args); |
||
31 | } |
||
32 | } |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | 102 | * @return array |
|
37 | */ |
||
38 | private function situations(): array |
||
39 | 102 | { |
|
40 | return [ |
||
41 | RouteSituations::class, |
||
42 | ViewSituations::class, |
||
43 | EloquentSituations::class, |
||
44 | EventSituations::class, |
||
45 | ]; |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * @param $d |
||
50 | */ |
||
51 | private function writeDebugInfo($d) |
||
54 | } |
||
55 | } |
||
56 |