Total Complexity | 8 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Coverage | 93.75% |
Changes | 0 |
1 | <?php |
||
11 | class HeyMan |
||
12 | { |
||
13 | use EloquentHooks, EventHooks, InputNormalizer; |
||
14 | |||
15 | private $chain; |
||
16 | |||
17 | /** |
||
18 | * HeyMan constructor. |
||
19 | * |
||
20 | * @param Chain $chain |
||
21 | */ |
||
22 | 102 | public function __construct(Chain $chain) |
|
25 | 102 | } |
|
26 | |||
27 | 15 | public function turnOff(): Consider |
|
28 | { |
||
29 | 15 | return new Consider('turnOff'); |
|
30 | } |
||
31 | |||
32 | 1 | public function turnOn(): Consider |
|
35 | } |
||
36 | |||
37 | 13 | public function forget(): Forget |
|
40 | } |
||
41 | |||
42 | 77 | public function __call($method, $args) |
|
43 | { |
||
44 | 77 | foreach ($this->mapping() as $className => $methods) { |
|
45 | 77 | if (str_contains($method, $methods)) { |
|
46 | 77 | return app($className)->$method(...$args); |
|
47 | } |
||
48 | } |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * @return array |
||
53 | */ |
||
54 | 77 | private function mapping(): array |
|
59 | ]; |
||
60 | } |
||
62 |