Passed
Push — master ( 8b321d...0f4e48 )
by Mostafa
12:21 queued 09:59
created

CacheEnum::getValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
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 getValue(): int|string
15
    {
16
        return $this->value;
17
    }
18
19
    public function equals(self $other): bool
20
    {
21
        return get_class($this) === get_class($other) and $this->getValue() === $other->getValue();
22
    }
23
}
24