PluginProbe
Booktics – Appointment Booking Calendar for Service Businesses / 1.0.27
Booktics – Appointment Booking Calendar for Service Businesses v1.0.27
1.0.29 1.0.28 1.0.27 1.0.26 1.0.25 1.0.24 1.0.23 1.0.22 1.0.21 1.0.20 1.0.19 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.2 1.0.3 All 31 releases
← All changes | core/payment/payment-method-manager.php +49 -49 1.0.1 → 1.0.27 View file →
@@ -1,49 +1,49 @@
1 -<?php
2 -
3 -namespace Booktics\Payment;
4 -
5 -use Booktics\Payment\Contracts\Payment_Method_Interface;
6 -use WP_Error;
7 -
8 -/**
9 - * Manager for payment methods.
10 - *
11 - * Allows registering and retrieving payment methods. Also handles processing
12 - * payments using a specified payment method.
13 - *
14 - * @package Booktics\Core\Payment
15 - * @since 1.0.0
16 - */
17 -class Payment_Method_Manager {
18 -
19 - private $payment_methods = array();
20 -
21 - public function __construct() {
22 - $this->payment_methods = apply_filters( 'booktics_payment_methods', array() );
23 - }
24 -
25 - /**
26 - * Get all registered payment methods
27 - *
28 - * @return array
29 - */
30 - public function get_payment_methods(): array {
31 - return apply_filters( 'booktics_payment_methods', $this->payment_methods );
32 - }
33 -
34 - /**
35 - * Get a payment method by its ID
36 - *
37 - * @param string $id
38 - *
39 - * @return Payment_Method_Interface|null Returns the payment method instance or null if not found
40 - */
41 - public function get_payment_method( string $id ): ?Payment_Method_Interface {
42 - $payment_methods = $this->get_payment_methods();
43 - if ( ! isset( $payment_methods[ $id ] ) ) {
44 - return null;
45 - }
46 -
47 - return new $payment_methods[ $id ]();
48 - }
49 -}
1 +<?php
2 +
3 +namespace Booktics\Payment;
4 +
5 +use Booktics\Payment\Contracts\Payment_Method_Interface;
6 +use WP_Error;
7 +
8 +/**
9 + * Manager for payment methods.
10 + *
11 + * Allows registering and retrieving payment methods. Also handles processing
12 + * payments using a specified payment method.
13 + *
14 + * @package Booktics\Core\Payment
15 + * @since 1.0.0
16 + */
17 +class Payment_Method_Manager {
18 +
19 + private $payment_methods = array();
20 +
21 + public function __construct() {
22 + $this->payment_methods = apply_filters( 'booktics_payment_methods', array() );
23 + }
24 +
25 + /**
26 + * Get all registered payment methods
27 + *
28 + * @return array
29 + */
30 + public function get_payment_methods(): array {
31 + return apply_filters( 'booktics_payment_methods', $this->payment_methods );
32 + }
33 +
34 + /**
35 + * Get a payment method by its ID
36 + *
37 + * @param string $id
38 + *
39 + * @return Payment_Method_Interface|null Returns the payment method instance or null if not found
40 + */
41 + public function get_payment_method( string $id ): ?Payment_Method_Interface {
42 + $payment_methods = $this->get_payment_methods();
43 + if ( ! isset( $payment_methods[ $id ] ) ) {
44 + return null;
45 + }
46 +
47 + return new $payment_methods[ $id ]();
48 + }
49 +}