public static function toConstant($value)
    {
        if (false !== ($_index = array_search($value, static::getDefinedConstants()))) {
            return $_index;
        }

        throw new \InvalidArgumentException('The value "' . $value . '" has no associated constant.');
    }