Server IP : 192.158.238.246 / Your IP : 18.222.226.15 Web Server : LiteSpeed System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64 User : jenniferflocom ( 1321) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/7779/task/7779/cwd/plugins/give/src/Framework/PaymentGateways/Traits/ |
Upload File : |
<?php namespace Give\Framework\PaymentGateways\Traits; use Give\Framework\Exceptions\Primitives\Exception; use Give\Framework\PaymentGateways\Exceptions\PaymentGatewayException; use Give\Framework\PaymentGateways\SubscriptionModule; /** * @since 2.20.0 * @property SubscriptionModule $subscriptionModule * @property array $routeMethods * @property array $secureRouteMethods */ trait HasRouteMethods { /** * Route methods are used to extend the gateway api. * By adding a custom routeMethod, you are effectively * registering a new public route url that will resolve itself and * call your method. * * @var string[] */ public $routeMethods = []; /** * Secure Route methods are used to extend the gateway api with an additional wp_nonce. * By adding a custom secureRouteMethod, you are effectively * registering a new route url that will resolve itself and * call your method after validating the nonce. * * @var string[] */ public $secureRouteMethods = []; /** * @since 2.20.0 * * @param string $method * * @return bool */ public function supportsMethodRoute($method) { $allGatewayMethods = array_merge($this->routeMethods, $this->secureRouteMethods); return in_array($method, $allGatewayMethods, true); } /** * @since 2.20.0 * * @param string $method * * @throws Exception */ public function callRouteMethod($method, $queryParams) { if ($this->supportsMethodRoute($method)) { return $this->$method($queryParams); } throw new PaymentGatewayException( sprintf( '%1$s route method is not supported by %2$s and %3$s', $method, get_class($this), get_class($this->subscriptionModule) ) ); } }