PayUserMoney::class, 2=>PayUserWechat::class, ]; protected static $type; /** * @return mixed */ public static function getType() { return self::$type; } /** * @param mixed $type */ public static function setType($type): void { if(!$type){ $type=1; } self::$type = $type; } /** * @return self */ public static function getClass(){ static $class; if(!$class){ $class=new self::$types[self::$type]; } return $class; } abstract function payment($amount,User $user,$type,$memo,$extra=[]); }