src/GerritDrost/Lib/Enum/Enum.php
private final static function loadClass($fqcn)
    {
        $reflectionClass = new ReflectionClass($fqcn);
        $constants       = $reflectionClass->getConstants();

        foreach ($constants as $name => $value) {
            $instance = new $fqcn($fqcn, $name, $value);

            /* @var $instance Enum */
            if (is_callable([$instance, '__initEnum'])) {
                $instance->__initEnum();
            }

            $instanceConstructorName = '__' . $name;
            if (is_callable([$instance, $instanceConstructorName])) {
                $instance->$instanceConstructorName();
            }

            if (!isset(self::$instances[$fqcn])) {
                self::$instances[$fqcn] = [];
            }

            self::$instances[$fqcn][$name] = $instance;
        }
    }
private final static function loadClass($fqcn)
    {
        $reflectionClass = new ReflectionClass($fqcn);
        $constants       = $reflectionClass->getConstants();

        foreach ($constants as $name => $value) {
            $instance = new $fqcn($fqcn, $name, $value);

            /* @var $instance Enum */
            if (is_callable([$instance, '__initEnum'])) {
                $instance->__initEnum();
            }

            $instanceConstructorName = '__' . $name;
            if (is_callable([$instance, $instanceConstructorName])) {
                $instance->$instanceConstructorName();
            }

            if (!isset(self::$instances[$fqcn])) {
                self::$instances[$fqcn] = [];
            }

            self::$instances[$fqcn][$name] = $instance;
        }
    }
private final static function loadClass ( $ fqcn ) { $ reflectionClass = new ReflectionClass ( $ fqcn ) ; $ constants = $ reflectionClass -> getConstants ( ) ; foreach ( $ constants as $ name => $ value ) { $ instance = new $ fqcn ( $ fqcn , $ name , $ value ) ; /* @var $instance Enum */ if ( is_callable ( [ $ instance , '__initEnum' ] ) ) { $ instance -> __initEnum ( ) ; } $ instanceConstructorName = '__' . $ name ; if ( is_callable ( [ $ instance , $ instanceConstructorName ] ) ) { $ instance -> $ instanceConstructorName ( ) ; } if ( ! isset ( self :: $ instances [ $ fqcn ] ) ) { self :: $ instances [ $ fqcn ] = [ ] ; } self :: $ instances [ $ fqcn ] [ $ name ] = $ instance ; } }
Uses reflection to load and cache all value singletons of the class represented by the fqcn.

@param string $fqcn FQCN of the enum
Uses reflection to load and cache all value singletons of the class represented by the fqcn .