public static function getByValue($value)
    {
        $class = get_called_class();
        $constants = array_flip(static::getConstants());
        if (isset($constants[$value])) {
            return self::$instances[$class][$constants[$value]] = new $class($value);
        } else {
            throw new \InvalidArgumentException('"' . $value . '" not defined');
        }
    }