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