Passed
Push — feature/second-release ( 99d7e6...3d3b5e )
by Andrea Marco
03:38
created

EnumeratesCacheKeys::__callStatic()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cerbero\LaravelEnum\Concerns;
6
7
use Cerbero\LaravelEnum\Services\CacheKey;
8
use Illuminate\Support\Str;
9
10
/**
11
 * The trait to enumerate cache keys.
12
 */
13
trait EnumeratesCacheKeys
14
{
15
    use Enumerates;
16
17
    /**
18
     * Handle the call to an inaccessible enum method.
19
     */
20 13
    public static function __callStatic(string $name, array $arguments): mixed
21
    {
22 13
        $key = Str::replaceArray('*', $arguments, self::fromName($name)->value);
23
24 13
        return new CacheKey($key);
25
    }
26
}
27