Passed
Push — master ( 8b9923...b95d07 )
by Mostafa
03:05 queued 36s
created

CacheEnum   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 3
c 1
b 0
f 0
dl 0
loc 12
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 1 1
A __callStatic() 0 3 1
A equals() 0 3 2
1
<?php
2
3
namespace Mostafaznv\LaraCache\Utils;
4
5
abstract class CacheEnum
6
{
7
    public function __construct(protected int|string $value) {}
8
9
    public static function __callStatic(string $name, array $arguments): self
10
    {
11
        return new static($name);
12
    }
13
14
    public function equals(self $other): bool
15
    {
16
        return get_class($this) === get_class($other) and $this->value === $other->value;
17
    }
18
}
19