src/sms/Sms.php
public function get($id, $throwException = true)
    {
        if (isset($this->_gateways[$id])) {
            return $this->_gateways[$id];
        }

        if (isset($this->_definitions[$id])) {
            $definition = $this->_definitions[$id];
            if (is_object($definition) && !$definition instanceof Closure) {
                return $this->_gateways[$id] = $definition;
            }

            return $this->_gateways[$id] = Yii::createObject($definition);
        } elseif ($throwException) {
            throw new InvalidConfigException("Unknown gateway ID: $id");
        }

        return null;
    }
public function get($id, $throwException = true)
    {
        if (isset($this->_gateways[$id])) {
            return $this->_gateways[$id];
        }

        if (isset($this->_definitions[$id])) {
            $definition = $this->_definitions[$id];
            if (is_object($definition) && !$definition instanceof Closure) {
                return $this->_gateways[$id] = $definition;
            }

            return $this->_gateways[$id] = Yii::createObject($definition);
        } elseif ($throwException) {
            throw new InvalidConfigException("Unknown gateway ID: $id");
        }

        return null;
    }
public function get ( $ id , $ throwException = true ) { if ( isset ( $ this -> _gateways [ $ id ] ) ) { return $ this -> _gateways [ $ id ] ; } if ( isset ( $ this -> _definitions [ $ id ] ) ) { $ definition = $ this -> _definitions [ $ id ] ; if ( is_object ( $ definition ) && ! $ definition instanceof Closure ) { return $ this -> _gateways [ $ id ] = $ definition ; } return $ this -> _gateways [ $ id ] = Yii :: createObject ( $ definition ) ; } elseif ( $ throwException ) { throw new InvalidConfigException ( "Unknown gateway ID: $id" ) ; } return null ; }
Returns the gateway instance with the specified ID.

@param string $id gateway ID (e.g. `db`).
@param bool $throwException whether to throw an exception if `$id` is not registered with the locator before.
@return object|null the gateway of the specified ID. If `$throwException` is false and `$id`
is not registered before, null will be returned.
@throws InvalidConfigException if `$id` refers to a nonexistent gateway ID
@see has()
@see set()
Returns the gateway instance with the specified ID .