PaymentMethodsList   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 33
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 2 1
A __construct() 0 2 1
A add_payment_method() 0 2 1
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\Ingenico;
4
5
/**
6
 * Title: Ingenico payment methods list (PMLIST parameter)
7
 * Description:
8
 * Copyright: 2005-2021 Pronamic
9
 * Company: Pronamic
10
 *
11
 * @author  Remco Tolsma
12
 * @version 2.0.0
13
 * @since   1.1.0
14
 */
15
class PaymentMethodsList {
16
	/**
17
	 * List
18
	 *
19
	 * @var array
20
	 */
21
	private $list;
22
23
	/**
24
	 * Constructs and initialize a payment methods list
25
	 */
26 3
	public function __construct( array $list = array() ) {
27 3
		$this->list = $list;
28 3
	}
29
30
	/**
31
	 * Add payment method
32
	 *
33
	 * @param string $payment_method
34
	 */
35 1
	public function add_payment_method( $payment_method ) {
36 1
		$this->list[] = $payment_method;
37 1
	}
38
39
	/**
40
	 * Create a string representation of this payment methods list
41
	 *
42
	 * List of selected payment methods and/or card brands to show on the payment page. Separated by a semi-colon.
43
	 *
44
	 * @return string
45
	 */
46 3
	public function __toString() {
47 3
		return implode( ';', $this->list );
48
	}
49
}
50