Passed
Push — master ( b8e26c...2f113f )
by Remco
05:42
created

CustomerInformation   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 66
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get_json() 0 16 2
A set_email_address() 0 2 1
1
<?php
2
/**
3
 * Customer information
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2018 Pronamic
7
 * @license   GPL-3.0-or-later
8
 * @package   Pronamic\WordPress\Pay\Gateways\OmniKassa2
9
 */
10
11
namespace Pronamic\WordPress\Pay\Gateways\OmniKassa2;
12
13
use InvalidArgumentException;
14
use stdClass;
15
use JsonSchema\Constraints\Constraint;
16
use JsonSchema\Exception\ValidationException;
17
use JsonSchema\Validator;
18
19
/**
20
 * Customer information
21
 *
22
 * @author  Remco Tolsma
23
 * @version 2.0.2
24
 * @since   2.0.2
25
 */
26
class CustomerInformation {
27
	/**
28
	 * The e-mailadress of the consumer.
29
	 *
30
	 * @var string
31
	 */
32
	private $email_address;
33
34
	/**
35
	 * The date of birth of the consumer.
36
	 *
37
	 * @var string
38
	 */
39
	private $date_of_birth;
40
41
	/**
42
	 * The gender of the consumer.
43
	 *
44
	 * @var string
45
	 */
46
	private $gender;
47
48
	/**
49
	 * The initials of the consumer.
50
	 *
51
	 * @var string
52
	 */
53
	private $initials;
54
55
	/**
56
	 * The consumer's telephone number.
57
	 *
58
	 * @var string
59
	 */
60
	private $telephone_number;
0 ignored issues
show
introduced by
The private property $telephone_number is not used, and could be removed.
Loading history...
61
62
	/**
63
	 * Set the e-mailadress of the consumer.
64
	 *
65
	 * @param string $email_address E-mailadress of the consumer.
66
	 */
67
	public function set_email_address( $email_address ) {
68
		$this->email_address = $email_address;
69
	}
70
71
	/**
72
	 * Get JSON.
73
	 *
74
	 * @return object
75
	 */
76
	public function get_json() {
77
		$data = array(
78
			'emailAddress'    => $this->email_address,
79
			'dateOfBirth'     => $this->date_of_birth,
80
			'gender'          => $this->gender,
81
			'initials'        => $this->initials,
82
			'telephoneNumber' => $this->telephoneNumber,
0 ignored issues
show
Bug introduced by
The property telephoneNumber does not exist on Pronamic\WordPress\Pay\G...sa2\CustomerInformation. Did you mean telephone_number?
Loading history...
83
		);
84
85
		$data = array_filter( $data );
86
87
		if ( empty( $data ) ) {
88
			return null;
89
		}
90
91
		return (object) $data;
92
	}
93
}
94