Code Duplication    Length = 10-11 lines in 2 locations

src/AbstractEnum.php 2 locations

@@ 42-52 (lines=11) @@
39
        return new static($value);
40
    }
41
42
    public static function __callStatic(string $methodName, array $arguments): self
43
    {
44
        foreach (self::getConstants() as $option => $value) {
45
            $expectedMethodName = self::getInflector()->camelize(strtolower($option));
46
            if ($expectedMethodName === $methodName) {
47
                return new static($value);
48
            }
49
        }
50
51
        throw new BadMethodCallException(sprintf('%s::%s() does not exist.', static::class, $methodName));
52
    }
53
54
    public function __call(string $methodName, array $arguments)
55
    {
@@ 54-63 (lines=10) @@
51
        throw new BadMethodCallException(sprintf('%s::%s() does not exist.', static::class, $methodName));
52
    }
53
54
    public function __call(string $methodName, array $arguments)
55
    {
56
        foreach (self::getConstants() as $option => $value) {
57
            $isaMethodName = 'is' . self::getInflector()->classify(strtolower($option));
58
            if ($isaMethodName === $methodName) {
59
                return $this->equals(static::get($value));
60
            }
61
        }
62
        throw new BadMethodCallException(sprintf('%s::%s() does not exist.', static::class, $methodName));
63
    }
64
65
    /**
66
     * @return mixed