getConstants(), true)) !== false) { return $key; } } catch (\ReflectionException $e) { } return null; } public function getValue(string $name) { try { $reflectionClass = new \ReflectionClass($this); return $reflectionClass->getConstant($name); } catch (\ReflectionException $e) { } return null; } /** * @return string[] */ public function getValues(): array { try { $reflectionClass = new \ReflectionClass($this); return $reflectionClass->getConstants(); } catch (\ReflectionException $e) { } return []; } }