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

EnumeratesCacheKeys   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
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 12
ccs 3
cts 3
cp 1
rs 10
wmc 1

1 Method

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