src/Container.php
public static function register($alias, $config)
    {
        if (is_array($config)) {
            $name = $config['class'];
            $singleton = !empty($config['singleton']);
            unset($config['class'], $config['singleton']);
            static::$classNames[$name] = static::$classAliases[$alias] = [
                'singleton' => $singleton,
                'class' => $name,
                'alias' => $alias,
                'properties' => $config,
            ];
        } elseif (is_callable($config)) {
            static::$classAliases[$alias] = ['class' => $config, 'alias' => $alias, 'properties' => []];
        } else {
            throw new ContainerException('Configuration must be an array or callable.');
        }

        unset(static::$instances[$alias]);
    }
public static function register($alias, $config)
    {
        if (is_array($config)) {
            $name = $config['class'];
            $singleton = !empty($config['singleton']);
            unset($config['class'], $config['singleton']);
            static::$classNames[$name] = static::$classAliases[$alias] = [
                'singleton' => $singleton,
                'class' => $name,
                'alias' => $alias,
                'properties' => $config,
            ];
        } elseif (is_callable($config)) {
            static::$classAliases[$alias] = ['class' => $config, 'alias' => $alias, 'properties' => []];
        } else {
            throw new ContainerException('Configuration must be an array or callable.');
        }

        unset(static::$instances[$alias]);
    }
public static function register ( $ alias , $ config ) { if ( is_array ( $ config ) ) { $ name = $ config [ 'class' ] ; $ singleton = ! empty ( $ config [ 'singleton' ] ) ; unset ( $ config [ 'class' ] , $ config [ 'singleton' ] ) ; static :: $ classNames [ $ name ] = static :: $ classAliases [ $ alias ] = [ 'singleton' => $ singleton , 'class' => $ name , 'alias' => $ alias , 'properties' => $ config , ] ; } elseif ( is_callable ( $ config ) ) { static :: $ classAliases [ $ alias ] = [ 'class' => $ config , 'alias' => $ alias , 'properties' => [ ] ] ; } else { throw new ContainerException ( 'Configuration must be an array or callable.' ) ; } unset ( static :: $ instances [ $ alias ] ) ; }
Registry class.

@param string $alias alias of class.
@param array|\Closure $config
@throws ContainerException
Registry class .