Automattic\WooCommerce\Internal\Admin\Settings
PaymentProviders::get_gateway_provider_instance()
Get the payment gateway provider instance.
Метод класса: PaymentProviders{}
Хуков нет.
Возвращает
PaymentGateway
. The payment gateway provider instance. Will return the general provider of no specific provider is found.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_gateway_provider_instance( $gateway_id ): PaymentGateway;
- $gateway_id(строка) (обязательный)
- The gateway ID.
Код PaymentProviders::get_gateway_provider_instance() PaymentProviders::get gateway provider instance WC 9.6.0
private function get_gateway_provider_instance( string $gateway_id ): PaymentGateway { if ( isset( $this->instances[ $gateway_id ] ) ) { return $this->instances[ $gateway_id ]; } // If the ID is not mapped to a provider class, return the generic provider. if ( ! isset( $this->payment_gateways_providers_class_map[ $gateway_id ] ) ) { if ( ! isset( $this->instances['generic'] ) ) { $this->instances['generic'] = new PaymentGateway(); } return $this->instances['generic']; } /** * The provider class for the gateway. * * @var PaymentGateway $provider_class */ $provider_class = $this->payment_gateways_providers_class_map[ $gateway_id ]; $this->instances[ $gateway_id ] = new $provider_class(); return $this->instances[ $gateway_id ]; }