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;
    }