IsMagic::__call()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 2
crap 1
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
The doc comment array<array-key, mixed> at position 2 could not be parsed: Unknown type name 'array-key' at position 2 in array<array-key, mixed>.
Loading history...
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
Documentation Bug introduced by
The doc comment array<array-key, mixed> at position 2 could not be parsed: Unknown type name 'array-key' at position 2 in array<array-key, mixed>.
Loading history...
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