下午陪家人和小孩,晚上练起来。
"; } public function authorizeOnlyPayment($amount) { echo $amount . " Stripe_authorizeOnlyPayment"; } public function cancelAmount($amount) { echo $amount . " Stripe_cancelAmount"; }}interface PaymentService { public function capture($amount); public function authorize($amount); public function cancel($amount);}class StripePaymentServiceAdapter implements PaymentService { private $stripe; public function __construct(Stripe $stripe) { $this->stripe = $stripe; } public function capture($amount) { $this->stripe->capturePayment($amount); } public function authorize($amount){ $this->stripe->authorizeOnlyPayment($amount); } public function cancel($amount) { $this->stripe->cancelAmount($amount); }}$stripe = new StripePaymentServiceAdapter(new Stripe());$stripe->authorize(49.99);$stripe->capture(19.99);$stripe->cancel(9.99);?>