@@ 51-56 (lines=6) @@ | ||
48 | $value = \unserialize($serialized); |
|
49 | $constants = self::getConstants(); |
|
50 | $name = \array_search($value, $constants, true); |
|
51 | if ($name === false) { |
|
52 | $message = \is_scalar($value) |
|
53 | ? 'Unknown value ' . \var_export($value, true) |
|
54 | : 'Invalid value of type ' . (\is_object($value) ? \get_class($value) : \gettype($value)); |
|
55 | throw new RuntimeException($message); |
|
56 | } |
|
57 | ||
58 | $class = \get_class($this); |
|
59 | $enumerator = $this; |
@@ 193-198 (lines=6) @@ | ||
190 | { |
|
191 | $constants = self::detectConstants(static::class); |
|
192 | $name = \array_search($value, $constants, true); |
|
193 | if ($name === false) { |
|
194 | $message = \is_scalar($value) |
|
195 | ? 'Unknown value ' . \var_export($value, true) |
|
196 | : 'Invalid value of type ' . (\is_object($value) ? \get_class($value) : \gettype($value)); |
|
197 | throw new InvalidArgumentException($message); |
|
198 | } |
|
199 | ||
200 | if (!isset(self::$instances[static::class][$name])) { |
|
201 | self::$instances[static::class][$name] = new static($constants[$name]); |