/*!
Returns 'current' gatewaytype.
504264
function getCurrentGatewayType( $event )
    {
        $gateway =  null;
        $http    = eZHTTPTool::instance();

        if ( $http->hasPostVariable( 'SelectButton' ) && $http->hasPostVariable( 'SelectedGateway' ) )
        {
            $gateway = $http->postVariable( 'SelectedGateway' );
            $event->setAttribute( 'data_text2', $gateway );
            $event->store();
        }
        else if ( $http->hasPostVariable( 'CancelButton' ) )
        {
            $gateway = null;
        }
        else
        {
            $gateway = $event->attribute( 'current_gateway' );
        }

        return $gateway;
    }
344513
public function getGateway()
    {
        if (null === $this->_gateway) {
            $this->_gateway = Commerce::getInstance()->getGateways()->getGatewayById($this->gatewayId);
        }

        return $this->_gateway;
    }
345210
public function getFromGateway($type) {
        $mapper = $this->config->getCcTypesMapper();
        $type   = strtolower($type);

        if( array_key_exists($type, $mapper) ) {
            return $mapper[$type];
        }

        return 'OT';
    }
1319843
public function current()
    {
        if (!$this->valid()) {
            return null;
        }

        $ob = $this->_data[$this->_ptr['idx']];

        return is_null($this->_ptr['subidx'])
            ? $ob
            : $ob->addresses[$this->_ptr['subidx']];
    }
1369470
private function _convertGateways()
    {
        $gateways = (new Query())
            ->select(['id', 'settings'])
            ->where(['type' => 'craft\\commerce\\gateways\\Stripe'])
            ->from(['{{%commerce_gateways}}'])
            ->all();

        $dbConnection = Craft::$app->getDb();

        foreach ($gateways as $gateway) {

            $settings = Json::decodeIfJson($gateway['settings']);

            if ($settings && isset($settings['includeReceiptEmailInRequests'])) {
                $settings['sendReceiptEmail'] = $settings['includeReceiptEmailInRequests'];
                unset($settings['includeReceiptEmailInRequests']);
            } else {
                $settings = [];
            }

            $settings = Json::encode($settings);

            $values = [
                'type' => Gateway::class,
                'settings' => $settings
            ];

            $dbConnection->createCommand()
                ->update('{{%commerce_gateways}}', $values, ['id' => $gateway['id']])
                ->execute();
        }
    }
824529
private function PaymentTypes()
    {
        $factory = Omnipay::getFactory();
        // since the omnipay gateway factory only returns gateways from the composer.json extra data,
        // we should merge it with user-defined gateways from Payment.allowed_gateways
        $gateways = array_unique(array_merge(
            $factory->all(),
            array_keys(GatewayInfo::getSupportedGateways(false))
        ));

        $supportedGateways = array();

        array_walk($gateways, function ($name, $index) use (&$supportedGateways, &$factory) {
            try {
                $instance = $factory->create($name);
                $supportedGateways[$name] = $instance;
            } catch (\Exception $e) {
            }
        });

        return $supportedGateways;
    }
888836
public function currentPostType(): string
    {
        if (!$this->Wp->is_admin) {
            return ''; // Not applicable.
        }
        return !empty($_GET['post_type'])
            ? $this->c::unslash((string) $_GET['post_type'])
            : $this->postTypeNow(); // Fallback on `$typenow`.
    }
1028083
public function gateway($name = null)
    {
        $name = $name ?: $this->getGateway();

        if ( ! isset($this->gateways[$name]))
        {
            $this->gateways[$name] = $this->resolve($name);
        }

        return $this->gateways[$name];
    }
899423
function getGateways( $gatewaysTypes )
    {
        $gateways           = array();
        $availableGateways  = $GLOBALS[ 'eZPaymentGateways' ];
        if ( !is_array( $availableGateways ) ){
            return $gateways;
        }

        if ( in_array( '-1', $gatewaysTypes ) )
        {
            $gatewaysTypes  = array_keys( $availableGateways );
        }

        foreach ( $gatewaysTypes as $key )
        {
            $gateway = $availableGateways[$key];

            $gateway['Name']    = $gateway['description'];
            $gateway['value']   = $key;
            $gateways[] = $gateway;
        }

        return $gateways;
    }
921391
public function setGatewayType($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Iot\V1\GatewayType::class);
        $this->gateway_type = $var;

        return $this;
    }
1309352
public function getGatewayInstance($gateway = null)
    {
        require __DIR__ . '/vendor/autoload.php';

        foreach ($this->getGateways() as $id) {
            $class = \Omnipay\Common\Helper::getGatewayClassName($id);
            if (class_exists($class)) {
                \Omnipay\Omnipay::register($id);
            }
        }

        $instances = array();
        foreach (\Omnipay\Omnipay::find() as $id) {
            $instances[$id] = \Omnipay\Omnipay::create($id);
        }

        if (isset($gateway)) {
            return empty($instances[$gateway]) ? null : $instances[$gateway];
        }

        return $instances;
    }
596638
protected function handleConnectGateway(string $gateway, array &$querystring) {
        if(!empty($querystring)) {
            if($this->compression !== '') {
                $compression = $this->compression;
                $querystring['compress'] = $compression::getName();
            }
            
            $this->gatewayQS = $querystring;
            $gateway = \rtrim($gateway, '/').'/?'.\http_build_query($querystring);
        }
        
        return $gateway;
    }
519076
public function current()
    {
        if ($this->type == self::KEYS) {
            return $this->current->key;
        } else {
            return $this->current->value;
        }
    }
720400
static public function getCurrentPath()
	{
	    $baseUrl = static::getRootUrl();
	    $parts = parse_url(static::getCurrentUrl());
	    $baseUrl .= isset($parts['path']) ? $parts['path'] : null;
	    
	    return rtrim($baseUrl, '/');
	}
273508
public function currentPath()
    {
        $requestURI = $this->serverVar('REQUEST_URI');
        $sciptName  = $this->serverVar('SCRIPT_NAME');
        return rtrim(parse_url($requestURI? : $sciptName, PHP_URL_PATH), '/');
    }
773645
function getCurrentApplication() {
        $url = \CharlotteDunois\Yasmin\HTTP\APIEndpoints::ENDPOINTS['currentOAuthApplication'];
        return $this->api->makeRequest('GET', $url, array());
    }
351388
def resolve(cls, full_path):
        """"""
        mod_path, _, app_path = full_path.partition(':')
        app = getattr(import_module(mod_path), app_path or 'application')

        with contextlib.suppress(TypeError):
            if issubclass(app, server.Gateway):
                return GatewayYo(app)

        return cls(app)