public static function isValid($value)
    {
        if (__CLASS__ === get_called_class()) {
            throw new \RuntimeException('Cannot call isValid() on ' . __CLASS__);
        }

        $reflectionClass = new \ReflectionClass(get_called_class());
        $validValues = $reflectionClass->getConstants();

        if (static::isBitFlag()) {
            $bitFlagAllOn = 0;

            foreach ($validValues as $validValue) {
                $bitFlagAllOn |= $validValue;
            }

            return ($value | $bitFlagAllOn) === $bitFlagAllOn;
        }

        return in_array($value, $validValues, true);
    }