public static function factory($name)
    {
        if (!isset(self::$services[$name])) {
            throw new \RuntimeException("The service [$name] don't register.");
        }

        $service = self::$services[$name];

        if (\is_object($service) && method_exists($service, '__invoke')) {
            return $service();
        }

        return $service;
    }
public static function factory($name)
    {
        if (!isset(self::$services[$name])) {
            throw new \RuntimeException("The service [$name] don't register.");
        }

        $service = self::$services[$name];

        if (\is_object($service) && method_exists($service, '__invoke')) {
            return $service();
        }

        return $service;
    }
public static function factory ( $ name ) { if ( ! isset ( self :: $ services [ $ name ] ) ) { throw new \ RuntimeException ( "The service [$name] don't register." ) ; } $ service = self :: $ services [ $ name ] ; if ( \ is_object ( $ service ) && method_exists ( $ service , '__invoke' ) ) { return $ service ( ) ; } return $ service ; }
create a app service by name
it always return a new instance.
@param string $name
@return mixed
@throws \RuntimeException
create a app service by name it always return a new instance .