Test Failed
Push — develop ( 5d1492...ddf0fb )
by Remco
03:56
created

Customer::get_array()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 13
rs 10
1
<?php
2
/**
3
 * Mollie customer.
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2020 Pronamic
7
 * @license   GPL-3.0-or-later
8
 * @package   Pronamic\WordPress\Pay
9
 */
10
11
namespace Pronamic\WordPress\Pay\Gateways\Mollie;
12
13
/**
14
 * Mollie customer
15
 *
16
 * @link    https://docs.mollie.com/reference/v2/customers-api/create-customer
17
 * @author  Remco Tolsma
18
 * @version 3.0.0
19
 * @since   3.0.0
20
 */
21
class Customer {
22
	/**
23
	 * ID.
24
	 *
25
	 * @var string|null
26
	 */
27
	private $id;
28
29
	/**
30
	 * Mode.
31
	 *
32
	 * @var string|null
33
	 */
34
	private $mode;
35
36
	/**
37
	 * Name.
38
	 *
39
	 * @var string|null
40
	 */
41
	private $name;
42
43
	/**
44
	 * Email.
45
	 *
46
	 * @var string|null
47
	 */
48
	private $email;
49
50
	/**
51
	 * Locale.
52
	 *
53
	 * @var string
54
	 */
55
	public $locale;
56
57
	/**
58
	 * Get ID.
59
	 *
60
	 * @return string|null
61
	 */
62
	public function get_id() {
63
		return $this->id;
64
	}
65
66
	/**
67
	 * Set ID.
68
	 *
69
	 * @param string|null $id ID.
70
	 */
71
	public function set_id( $id ) {
72
		$this->id = $id;
73
	}
74
75
	/**
76
	 * Get mode.
77
	 *
78
	 * @return string|null
79
	 */
80
	public function get_mode() {
81
		return $this->id;
82
	}
83
84
	/**
85
	 * Set mode.
86
	 *
87
	 * @param string|null $mode Mode.
88
	 */
89
	public function set_mode( $mode ) {
90
		$this->mode = $mode;
91
	}
92
93
	/**
94
	 * Get name.
95
	 *
96
	 * @return string|null
97
	 */
98
	public function get_name() {
99
		return $this->name;
100
	}
101
102
	/**
103
	 * Set name.
104
	 *
105
	 * @param string|null $name Name.
106
	 */
107
	public function set_name( $name ) {
108
		$this->name = $name;
109
	}
110
111
	/**
112
	 * Get email.
113
	 *
114
	 * @return string|null
115
	 */
116
	public function get_email() {
117
		return $this->email;
118
	}
119
120
	/**
121
	 * Set email.
122
	 *
123
	 * @param string|null $email Email.
124
	 */
125
	public function set_email( $email ) {
126
		$this->email = $email;
127
	}
128
129
	/**
130
	 * Get locale.
131
	 *
132
	 * @return string|null
133
	 */
134
	public function get_locale() {
135
		return $this->locale;
136
	}
137
138
	/**
139
	 * Set locale.
140
	 *
141
	 * @param string|null $email Email.
142
	 */
143
	public function set_locale( $locale ) {
144
		$this->locale = $locale;
145
	}
146
147
	/**
148
	 * Get array.
149
	 *
150
	 * @return array
151
	 */
152
	public function get_array() {
153
		$array = array(
154
			'name'   => $this->get_name(),
155
			'email'  => $this->get_email(),
156
			'locale' => $this->get_locale(),
157
		);
158
159
		/*
160
		 * Array filter will remove values NULL, FALSE and empty strings ('')
161
		 */
162
		$array = array_filter( $array );
163
164
		return $array;
165
	}
166
}
167