src/helpers/BaseYii.php
public static function get(string $name, ContainerInterface $container = null, bool $throwException = true)
    {
        if ($container === null) {
            $container = static::$container;
        }

        if ($container !== null && $container->has($name)) {
            return static::$container->get($name);
        }

        if ($throwException) {
            throw new InvalidConfigException("No '$name' service can be found");
        } else {
            return null;
        }
    }
public static function get(string $name, ContainerInterface $container = null, bool $throwException = true)
    {
        if ($container === null) {
            $container = static::$container;
        }

        if ($container !== null && $container->has($name)) {
            return static::$container->get($name);
        }

        if ($throwException) {
            throw new InvalidConfigException("No '$name' service can be found");
        } else {
            return null;
        }
    }
public static function get ( string $ name , ContainerInterface $ container = null , bool $ throwException = true ) { if ( $ container === null ) { $ container = static :: $ container ; } if ( $ container !== null && $ container -> has ( $ name ) ) { return static :: $ container -> get ( $ name ) ; } if ( $ throwException ) { throw new InvalidConfigException ( "No '$name' service can be found" ) ; } else { return null ; } }
Returns service from container.
@param string $name service or class/interface name.
@param ContainerInterface $container DI container, default one will be used if not given.
@param bool $throwException whether to throw an exception or return null.
@return object service object.
Returns service from container .