ÿØÿà JFIF    ÿÛ „  ( %"1!%)+...383,7(-.+  -+++--++++---+-+-----+---------------+---+-++7-----ÿÀ  ß â" ÿÄ     ÿÄ H    !1AQaq"‘¡2B±ÁÑð#R“Ò Tbr‚²á3csƒ’ÂñDS¢³$CÿÄ   ÿÄ %  !1AQa"23‘ÿÚ   ? ôÿ ¨pŸªáÿ —åYõõ\?àÒü©ŠÄï¨pŸªáÿ —åYõõ\?àÓü©ŠÄá 0Ÿªáÿ Ÿå[úƒ ú®ði~TÁbqÐ8OÕpÿ ƒOò¤Oè`–RÂáœá™êi€ßÉ< FtŸI“öÌ8úDf´°å}“¾œ6  öFá°y¥jñÇh†ˆ¢ã/ÃÐ:ªcÈ "Y¡ðÑl>ÿ ”ÏËte:qž\oäŠe÷󲍷˜HT4&ÿ ÓÐü6ö®¿øþßèô Ÿ•7Ñi’•j|“ñì>b…þS?*Óôÿ ÓÐü*h¥£ír¶ü UãS炟[AÐaè[ûª•õ&õj?†Éö+EzP—WeÒírJFt ‘BŒ†Ï‡%#tE Øz ¥OÛ«!1›üä±Í™%ºÍãö]°î(–:@<‹ŒÊö×òÆt¦ãº+‡¦%ÌÁ²h´OƒJŒtMÜ>ÀÜÊw3Y´•牋4ǍýʏTì>œú=Íwhyë,¾Ôò×õ¿ßÊa»«þˆѪQ|%6ž™A õ%:øj<>É—ÿ Å_ˆCbõ¥š±ý¯Ýƒï…¶|RëócÍf溪“t.СøTÿ *Ä¿-{†çàczůŽ_–^XþŒ±miB[X±d 1,é”zEù»& î9gœf™9Ð'.;—™i}!ôšåîqêÛ٤ёý£½ÆA–àôe"A$˝Úsäÿ ÷Û #°xŸëí(l »ý3—¥5m! rt`†0~'j2(]S¦¦kv,ÚÇ l¦øJA£Šƒ J3E8ÙiŽ:cÉžúeZ°€¯\®kÖ(79«Ž:¯X”¾³Š&¡* ….‰Ž(ÜíŸ2¥ª‡×Hi²TF¤ò[¨íÈRëÉ䢍mgÑ.Ÿ<öäS0í„ǹÁU´f#Vß;Õ–…P@3ío<ä-±»Ž.L|kªÀê›fÂ6@»eu‚|ÓaÞÆŸ…¨ááå>åŠ?cKü6ùTÍÆ”†sĤÚ;H2RÚ†õ\Ö·Ÿn'¾ ñ#ºI¤Å´%çÁ­‚â7›‹qT3Iï¨ÖÚ5I7Ë!ÅOóŸ¶øÝñØôת¦$Tcö‘[«Ö³šÒ';Aþ ¸èíg A2Z"i¸vdÄ÷.iõ®§)¿]¤À†–‡É&ä{V¶iŽ”.Ó×Õÿ û?h¬Mt–íª[ÿ Ñÿ ÌV(í}=ibÔ¡›¥¢±b Lô¥‡piη_Z<‡z§èŒ)iÖwiÇ 2hÙ3·=’d÷8éŽ1¦¸c¤µ€7›7Ø ð\á)} ¹fËí›pAÃL%âc2 í§æQz¿;T8sæ°qø)QFMð‰XŒÂ±N¢aF¨…8¯!U  Z©RÊ ÖPVÄÀÍin™Ì-GˆªÅËŠ›•zË}º±ŽÍFò¹}Uw×#ä5B¤{î}Ð<ÙD é©¤&‡ïDbàÁôMÁ. * @author Daniel Costa * @author Mirosław Filip * * @psalm-template T * @psalm-immutable * @psalm-consistent-constructor */ abstract class Enum implements \JsonSerializable, \Stringable { /** * Enum value * * @var mixed * @psalm-var T */ protected $value; /** * Enum key, the constant name * * @var string */ private $key; /** * Store existing constants in a static cache per object. * * * @var array * @psalm-var array> */ protected static $cache = []; /** * Cache of instances of the Enum class * * @var array * @psalm-var array> */ protected static $instances = []; /** * Creates a new value of some type * * @psalm-pure * @param mixed $value * * @psalm-param T $value * @throws \UnexpectedValueException if incompatible type is given. */ public function __construct($value) { if ($value instanceof static) { /** @psalm-var T */ $value = $value->getValue(); } /** @psalm-suppress ImplicitToStringCast assertValidValueReturningKey returns always a string but psalm has currently an issue here */ $this->key = static::assertValidValueReturningKey($value); /** @psalm-var T */ $this->value = $value; } /** * This method exists only for the compatibility reason when deserializing a previously serialized version * that didn't had the key property */ public function __wakeup() { /** @psalm-suppress DocblockTypeContradiction key can be null when deserializing an enum without the key */ if ($this->key === null) { /** * @psalm-suppress InaccessibleProperty key is not readonly as marked by psalm * @psalm-suppress PossiblyFalsePropertyAssignmentValue deserializing a case that was removed */ $this->key = static::search($this->value); } } /** * @param mixed $value * @return static */ public static function from($value): self { $key = static::assertValidValueReturningKey($value); return self::__callStatic($key, []); } /** * @psalm-pure * @return mixed * @psalm-return T */ public function getValue() { return $this->value; } /** * Returns the enum key (i.e. the constant name). * * @psalm-pure * @return string */ public function getKey() { return $this->key; } /** * @psalm-pure * @psalm-suppress InvalidCast * @return string */ public function __toString() { return (string)$this->value; } /** * Determines if Enum should be considered equal with the variable passed as a parameter. * Returns false if an argument is an object of different class or not an object. * * This method is final, for more information read https://github.com/myclabs/php-enum/issues/4 * * @psalm-pure * @psalm-param mixed $variable * @return bool */ final public function equals($variable = null): bool { return $variable instanceof self && $this->getValue() === $variable->getValue() && static::class === \get_class($variable); } /** * Returns the names (keys) of all constants in the Enum class * * @psalm-pure * @psalm-return list * @return array */ public static function keys() { return \array_keys(static::toArray()); } /** * Returns instances of the Enum class of all Enum constants * * @psalm-pure * @psalm-return array * @return static[] Constant name in key, Enum instance in value */ public static function values() { $values = array(); /** @psalm-var T $value */ foreach (static::toArray() as $key => $value) { $values[$key] = new static($value); } return $values; } /** * Returns all possible values as an array * * @psalm-pure * @psalm-suppress ImpureStaticProperty * * @psalm-return array * @return array Constant name in key, constant value in value */ public static function toArray() { $class = static::class; if (!isset(static::$cache[$class])) { /** @psalm-suppress ImpureMethodCall this reflection API usage has no side-effects here */ $reflection = new \ReflectionClass($class); /** @psalm-suppress ImpureMethodCall this reflection API usage has no side-effects here */ static::$cache[$class] = $reflection->getConstants(); } return static::$cache[$class]; } /** * Check if is valid enum value * * @param $value * @psalm-param mixed $value * @psalm-pure * @psalm-assert-if-true T $value * @return bool */ public static function isValid($value) { return \in_array($value, static::toArray(), true); } /** * Asserts valid enum value * * @psalm-pure * @psalm-assert T $value * @param mixed $value */ public static function assertValidValue($value): void { self::assertValidValueReturningKey($value); } /** * Asserts valid enum value * * @psalm-pure * @psalm-assert T $value * @param mixed $value * @return string */ private static function assertValidValueReturningKey($value): string { if (false === ($key = static::search($value))) { throw new \UnexpectedValueException("Value '$value' is not part of the enum " . static::class); } return $key; } /** * Check if is valid enum key * * @param $key * @psalm-param string $key * @psalm-pure * @return bool */ public static function isValidKey($key) { $array = static::toArray(); return isset($array[$key]) || \array_key_exists($key, $array); } /** * Return key for value * * @param mixed $value * * @psalm-param mixed $value * @psalm-pure * @return string|false */ public static function search($value) { return \array_search($value, static::toArray(), true); } /** * Returns a value when called statically like so: MyEnum::SOME_VALUE() given SOME_VALUE is a class constant * * @param string $name * @param array $arguments * * @return static * @throws \BadMethodCallException * * @psalm-pure */ public static function __callStatic($name, $arguments) { $class = static::class; if (!isset(self::$instances[$class][$name])) { $array = static::toArray(); if (!isset($array[$name]) && !\array_key_exists($name, $array)) { $message = "No static method or enum constant '$name' in class " . static::class; throw new \BadMethodCallException($message); } return self::$instances[$class][$name] = new static($array[$name]); } return clone self::$instances[$class][$name]; } /** * Specify data which should be serialized to JSON. This method returns data that can be serialized by json_encode() * natively. * * @return mixed * @link http://php.net/manual/en/jsonserializable.jsonserialize.php * @psalm-pure */ #[\ReturnTypeWillChange] public function jsonSerialize() { return $this->getValue(); } }