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

CacheEnum::equals()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 2
nc 2
nop 1
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