public function getGateway($id): GatewayInterface
    {
        $gateway = $this->_gateways[$id] ?? null;

        if ($gateway === null) {
            throw new InvalidArgumentException("Gateway: `$id` not exist!");
        } elseif (!$gateway instanceof GatewayInterface) {

            if (is_string($gateway)) {
                $gateway = ['class' => $gateway];
            }

            if (is_array($gateway)) {
                $gateway = ArrayHelper::merge($this->gatewayConfig, $gateway);
            }

            $gateway = $this->_gateways[$id] = Yii::createObject($gateway);
        }

        return $gateway;
    }
public function getGateway($id): GatewayInterface
    {
        $gateway = $this->_gateways[$id] ?? null;

        if ($gateway === null) {
            throw new InvalidArgumentException("Gateway: `$id` not exist!");
        } elseif (!$gateway instanceof GatewayInterface) {

            if (is_string($gateway)) {
                $gateway = ['class' => $gateway];
            }

            if (is_array($gateway)) {
                $gateway = ArrayHelper::merge($this->gatewayConfig, $gateway);
            }

            $gateway = $this->_gateways[$id] = Yii::createObject($gateway);
        }

        return $gateway;
    }
public function getGateway ( $ id ) : GatewayInterface { $ gateway = $ this -> _gateways [ $ id ] ?? null ; if ( $ gateway === null ) { throw new InvalidArgumentException ( "Gateway: `$id` not exist!" ) ; } elseif ( ! $ gateway instanceof GatewayInterface ) { if ( is_string ( $ gateway ) ) { $ gateway = [ 'class' => $ gateway ] ; } if ( is_array ( $ gateway ) ) { $ gateway = ArrayHelper :: merge ( $ this -> gatewayConfig , $ gateway ) ; } $ gateway = $ this -> _gateways [ $ id ] = Yii :: createObject ( $ gateway ) ; } return $ gateway ; }
Get gateway by id given.

@param int|string $id An id of gateway need to get.
@return GatewayInterface object gateway define by arg name.
@throws \yii\base\InvalidConfigException
Get gateway by id given .