Customer::getDocumentType()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Getnet\API;
4
5
/**
6
 * Class Customer
7
 *
8
 * @package Getnet\API
9
 */
10
class Customer implements \JsonSerializable
11
{
12
    const DOCUMENT_TYPE_CPF  = "CPF";
13
    const DOCUMENT_TYPE_CNPJ = "CNPJ";
14
15
    /** @var */
16
    private $customer_id;
17
18
    /** @var */
19
    private $first_name;
20
21
    /** @var */
22
    private $last_name;
23
24
    /** @var */
25
    private $name;
26
27
    /** @var */
28
    private $email;
29
30
    /** @var */
31
    private $document_type;
32
33
    /** @var */
34
    private $document_number;
35
36
    /** @var */
37
    private $phone_number;
38
39
    /** @var */
40
    private $billing_address;
41
42
    /**
43
     * Customer constructor.
44
     * @param $customer_id
45
     */
46
    public function __construct($customer_id)
47
    {
48
        $this->setCustomerId($customer_id);
49
    }
50
51
    /**
52
     * @return array|mixed
53
     */
54 View Code Duplication
    public function jsonSerialize()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
55
    {
56
        $vars = get_object_vars($this);
57
58
        $vars_clear = array_filter($vars, function ($value) {
59
            return null !== $value;
60
        });
61
62
        return $vars_clear;
63
    }
64
65
    /**
66
     * @return mixed
67
     */
68
    public function getCustomerId()
69
    {
70
        return $this->customer_id;
71
    }
72
73
    /**
74
     * @param $customer_id
75
     * @return $this
76
     */
77
    public function setCustomerId($customer_id)
78
    {
79
        $this->customer_id = (string)$customer_id;
80
81
        return $this;
82
    }
83
84
    /**
85
     * @return mixed
86
     */
87
    public function getFirstName()
88
    {
89
        return $this->first_name;
90
    }
91
92
    /**
93
     * @param $first_name
94
     * @return $this
95
     */
96
    public function setFirstName($first_name)
97
    {
98
        $this->first_name = (string)$first_name;
99
100
        return $this;
101
    }
102
103
    /**
104
     * @return mixed
105
     */
106
    public function getLastName()
107
    {
108
        return $this->last_name;
109
    }
110
111
    /**
112
     * @param $last_name
113
     * @return $this
114
     */
115
    public function setLastName($last_name)
116
    {
117
        $this->last_name = (string)$last_name;
118
119
        return $this;
120
    }
121
122
    /**
123
     * @return mixed
124
     */
125
    public function getName()
126
    {
127
        return $this->name;
128
    }
129
130
    /**
131
     * @param $name
132
     * @return $this
133
     */
134
    public function setName($name)
135
    {
136
        $this->name = (string)$name;
137
138
        return $this;
139
    }
140
141
    /**
142
     * @return mixed
143
     */
144
    public function getEmail()
145
    {
146
        return $this->email;
147
    }
148
149
    /**
150
     * @param $email
151
     * @return $this
152
     */
153
    public function setEmail($email)
154
    {
155
        $this->email = (string)$email;
156
157
        return $this;
158
    }
159
160
    /**
161
     * @return mixed
162
     */
163
    public function getDocumentType()
164
    {
165
        return $this->document_type;
166
    }
167
168
    /**
169
     * @param $document_type
170
     * @return $this
171
     */
172
    public function setDocumentType($document_type)
173
    {
174
        $this->document_type = (string)$document_type;
175
176
        return $this;
177
    }
178
179
    /**
180
     * @return mixed
181
     */
182
    public function getDocumentNumber()
183
    {
184
        return $this->document_number;
185
    }
186
187
    /**
188
     * @param $document_number
189
     * @return $this
190
     */
191
    public function setDocumentNumber($document_number)
192
    {
193
        $this->document_number = (string)$document_number;
194
195
        return $this;
196
    }
197
198
    /**
199
     * @return mixed
200
     */
201
    public function getPhoneNumber()
202
    {
203
        return $this->phone_number;
204
    }
205
206
    /**
207
     * @param $phone_number
208
     * @return $this
209
     */
210
    public function setPhoneNumber($phone_number)
211
    {
212
        $this->phone_number = (string)$phone_number;
213
214
        return $this;
215
    }
216
217
    /**
218
     * @return Address
219
     */
220
    public function billingAddress()
221
    {
222
        $address = new Address();
223
224
        $this->setBillingAddress($address);
225
226
        return $address;
227
    }
228
229
    /**
230
     * @return mixed
231
     */
232
    public function getBillingAddress()
233
    {
234
        return $this->billing_address;
235
    }
236
237
    /**
238
     * @param $billing_address
239
     * @return $this
240
     */
241
    public function setBillingAddress($billing_address)
242
    {
243
        $this->billing_address = $billing_address;
244
245
        return $this;
246
    }
247
}
248