Merchant::__toString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 13
ccs 0
cts 9
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * Merchant
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2022 Pronamic
7
 * @license   GPL-3.0-or-later
8
 * @package   Pronamic\WordPress\Pay\Payments
9
 */
10
11
namespace Pronamic\WordPress\Pay\Gateways\Sisow;
12
13
/**
14
 * Title: Sisow merchant
15
 * Description:
16
 * Copyright: 2005-2022 Pronamic
17
 * Company: Pronamic
18
 *
19
 * @author  Reüel van der Steege
20
 * @version 2.0.2
21
 * @since   2.0.2
22
 */
23
class Merchant {
24
	/**
25
	 * Merchant ID.
26
	 *
27
	 * @var string
28
	 */
29
	public $merchant_id;
30
31
	/**
32
	 * Payment methods.
33
	 *
34
	 * @var array<int,string>
35
	 */
36
	public $payments;
37
38
	/**
39
	 * Create an string representation of this object
40
	 *
41
	 * @return string
42
	 */
43
	public function __toString() {
44
		$pieces = array(
45
			$this->merchant_id,
46
			implode( ', ', $this->payments ),
47
		);
48
49
		$pieces = array_map( 'trim', $pieces );
50
51
		$pieces = array_filter( $pieces );
52
53
		$string = implode( PHP_EOL, $pieces );
54
55
		return $string;
56
	}
57
}
58