Failed Conditions
Push — master ( 9263c5...be09a5 )
by Reüel
11:06 queued 04:51
created

ApplePayGateway::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 9
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 12
ccs 0
cts 10
cp 0
crap 2
rs 9.9666
1
<?php
2
/**
3
 * Apple Pay gateway
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2020 Pronamic
7
 * @license   GPL-3.0-or-later
8
 * @package   Pronamic\WordPress\Pay\Extensions\MemberPress
9
 */
10
11
namespace Pronamic\WordPress\Pay\Extensions\MemberPress\Gateways;
12
13
use Pronamic\WordPress\Pay\Core\PaymentMethods;
14
use Pronamic\WordPress\Pay\Extensions\MemberPress\Pronamic;
15
16
/**
17
 * WordPress pay MemberPress Apple Pay gateway
18
 *
19
 * @author  Reüel van der Steege
20
 * @version 2.3.0
21
 * @since   2.3.0
22
 */
23
class ApplePayGateway extends Gateway {
24
	/**
25
	 * Payment method.
26
	 *
27
	 * @var string
28
	 */
29
	protected $payment_method = PaymentMethods::APPLE_PAY;
30
31
	/**
32
	 * Constructs and initialize Apple Pay gateway.
33
	 */
34
	public function __construct() {
35
		parent::__construct();
36
37
		// Capabilities.
38
		$this->capabilities = array(
39
			'process-payments',
40
			'create-subscriptions',
41
			'cancel-subscriptions',
42
			'update-subscriptions',
43
			'suspend-subscriptions',
44
			'resume-subscriptions',
45
			'subscription-trial-payment',
46
		);
47
	}
48
49
	/**
50
	 * Get alias class name of this gateway.
51
	 *
52
	 * @return string
53
	 */
54
	public function get_alias() {
55
		return 'MeprApplePayGateway';
56
	}
57
58
	/**
59
	 * Get icon function, please note that this is not a MemberPress function.
60
	 *
61
	 * @since 2.0.8
62
	 * @return string
63
	 */
64
	protected function get_icon() {
65
		return Pronamic::get_method_icon_url( $this->payment_method );
66
	}
67
}
68