src/Traits/LiteContainerStaticTrait.php
public static function get($name, $call = true)
    {
        if (!isset(self::$services[$name])) {
            throw new \RuntimeException("The service [$name] don't register.");
        }

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

        if (\is_object($service) && $service instanceof \Closure && $call) {
            if (!isset(self::$instances[$name])) {
                self::$instances[$name] = $service();
            }

            return self::$instances[$name];
        }

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

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

        if (\is_object($service) && $service instanceof \Closure && $call) {
            if (!isset(self::$instances[$name])) {
                self::$instances[$name] = $service();
            }

            return self::$instances[$name];
        }

        return $service;
    }
public static function get ( $ name , $ call = true ) { if ( ! isset ( self :: $ services [ $ name ] ) ) { throw new \ RuntimeException ( "The service [$name] don't register." ) ; } $ service = self :: $ services [ $ name ] ; if ( \ is_object ( $ service ) && $ service instanceof \ Closure && $ call ) { if ( ! isset ( self :: $ instances [ $ name ] ) ) { self :: $ instances [ $ name ] = $ service ( ) ; } return self :: $ instances [ $ name ] ; } return $ service ; }
get a app service by name
if is a closure, only run once.
@param string $name
@param bool $call if service is 'Closure', call it.
@return mixed
@throws \RuntimeException
get a app service by name if is a closure only run once .