/** * @param GatewayInterface $gatewayInstance * @param string|null $alias */ public function registerGateway(GatewayInterface $gatewayInstance, $alias = null) { $name = $alias ?: Helper::getGatewayShortName(get_class($gatewayInstance)); if (in_array($name, $this->disabledGateways)) { return; } $this->registeredGateways[$name] = $gatewayInstance; if ($this->initializeOnRegistration) { $gatewayInstance->initialize($this->getGatewayConfig($name)); $this->cache[$name] = $gatewayInstance; } }
/** * Get the short name of the Gateway * * @return string */ public function getShortName() { return Helper::getGatewayShortName(get_class($this)); }
public function testGetGatewayShortNameCustomGateway() { $shortName = Helper::getGatewayShortName('\\Custom\\Gateway'); $this->assertSame('\\Custom\\Gateway', $shortName); }
/** * @param GatewayInterface $gatewayInstance * @param string|null $alias */ public function registerGateway(GatewayInterface $gatewayInstance, $alias = null) { $name = $alias ?: Helper::getGatewayShortName(get_class($gatewayInstance)); $this->registeredGateways[$name] = $gatewayInstance; }