1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace Cerbero\Enum\Concerns; |
||
6 | |||
7 | use Cerbero\Enum\Enums; |
||
8 | |||
9 | /** |
||
10 | * The trait to handle the magic methods of an enum. |
||
11 | */ |
||
12 | trait IsMagic |
||
13 | { |
||
14 | /** |
||
15 | * Handle the call to an inaccessible enum method. |
||
16 | * |
||
17 | * @param array<array-key, mixed> $arguments |
||
0 ignored issues
–
show
Documentation
Bug
introduced
by
![]() |
|||
18 | */ |
||
19 | 4 | public static function __callStatic(string $name, array $arguments): mixed |
|
20 | { |
||
21 | 4 | return Enums::handleStaticCall(self::class, $name, $arguments); |
|
22 | } |
||
23 | |||
24 | /** |
||
25 | * Handle the call to an inaccessible case method. |
||
26 | * |
||
27 | * @param array<array-key, mixed> $arguments |
||
0 ignored issues
–
show
|
|||
28 | */ |
||
29 | 14 | public function __call(string $name, array $arguments): mixed |
|
30 | { |
||
31 | 14 | return Enums::handleCall($this, $name, $arguments); |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * Handle the invocation of a case. |
||
36 | */ |
||
37 | 2 | public function __invoke(mixed ...$arguments): mixed |
|
38 | { |
||
39 | 2 | return Enums::handleInvoke($this, ...$arguments); |
|
40 | } |
||
41 | } |
||
42 |