Tribe__Events__Community__Tickets__Main::gateway( string $gateway )

Gateway object accessor method.


Parameters #

$gateway

(string) (Required) Which static gateway to retrieve.


Top ↑

Return #

(Tribe__Events__Community__Tickets__Gateway__Abstract|WP_Error) Gateway object or error object if class does not exist.


Top ↑

Source #

File: src/Tribe/Main.php

	public function gateway( $gateway ) {
		static $gateways = array();

		if ( empty( $gateways[ $gateway ] ) ) {
			$gateway_class = "Tribe__Events__Community__Tickets__Gateway__{$gateway}";

			if ( ! class_exists( $gateway_class ) ) {
				return new WP_Error( "{$gateway_class} does not exist" );
			}

			$gateways[ $gateway ] = new $gateway_class;
		}

		return $gateways[ $gateway ];
	}