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

IsMagic   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 24
ccs 6
cts 6
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __call() 0 3 1
A __invoke() 0 3 1
A __callStatic() 0 3 1
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