Passed
Push — develop ( 9b8c4e...79e7ae )
by Andrea Marco
03:34 queued 14s
created

IsMagic::__callStatic()   A

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
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Cerbero\LaravelEnum\Concerns;
4
5
use Cerbero\LaravelEnum\Enums;
6
7
/**
8
 * The trait to handle the magic methods of an enum.
9
 */
10
trait IsMagic
11
{
12
    /**
13
     * Handle the call to an inaccessible enum method.
14
     */
15 1
    public static function __callStatic(string $name, array $arguments): mixed
16
    {
17 1
        return Enums::handleStaticCall(self::class, $name, $arguments);
18
    }
19
20
    /**
21
     * Handle the call to an inaccessible case method.
22
     */
23 10
    public function __call(string $name, array $arguments): mixed
24
    {
25 10
        return Enums::handleCall($this, $name, $arguments);
26
    }
27
28
    /**
29
     * Handle the invocation of a case.
30
     */
31 1
    public function __invoke(mixed ...$arguments): mixed
32
    {
33 1
        return Enums::handleInvoke($this, ...$arguments);
34
    }
35
}
36