GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Customer   F
last analyzed

Complexity

Total Complexity 70

Size/Duplication

Total Lines 533
Duplicated Lines 0 %

Coupling/Cohesion

Components 8
Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 70
c 2
b 0
f 0
lcom 8
cbo 2
dl 0
loc 533
rs 2.7272

68 Methods

Rating   Name   Duplication   Size   Complexity  
A setGenerator() 0 4 1
A isUniqueEmailAddressGenerated() 0 4 1
A setUniqueEmailAddressGenerated() 0 4 1
A getBillingFirstName() 0 4 1
A setBillingFirstName() 0 4 1
A getBillingLastName() 0 4 1
A setBillingLastName() 0 4 1
A getBillingCompany() 0 4 1
A setBillingCompany() 0 4 1
A getEmailAddress() 0 4 1
A setEmailAddress() 0 4 1
A getBillingAddress() 0 4 1
A setBillingAddress() 0 4 1
A getBillingAddress2() 0 4 1
A setBillingAddress2() 0 4 1
A getBillingCity() 0 4 1
A setBillingCity() 0 4 1
A getBillingRegionId() 0 4 1
A setBillingRegionId() 0 4 1
A getBillingPostCode() 0 4 1
A setBillingPostCode() 0 4 1
A getBillingCountryId() 0 4 1
A setBillingCountryId() 0 4 1
A getBillingTelephone() 0 4 1
A setBillingTelephone() 0 4 1
A getBillingFax() 0 4 1
A setBillingFax() 0 4 1
A getShippingFirstName() 0 4 1
A setShippingFirstName() 0 4 1
A getShippingLastName() 0 4 1
A setShippingLastName() 0 4 1
A getShippingCompany() 0 4 1
A setShippingCompany() 0 4 1
A getShippingAddress() 0 4 1
A setShippingAddress() 0 4 1
A getShippingAddress2() 0 4 1
A setShippingAddress2() 0 4 1
A getShippingCity() 0 4 1
A setShippingCity() 0 4 1
A getShippingRegionId() 0 4 1
A setShippingRegionId() 0 4 1
A getShippingPostCode() 0 4 1
A setShippingPostCode() 0 4 1
A getShippingCountryId() 0 4 1
A setShippingCountryId() 0 4 1
A getShippingTelephone() 0 4 1
A setShippingTelephone() 0 4 1
A getShippingFax() 0 4 1
A setShippingFax() 0 4 1
A getCompany() 0 4 1
A getAddress() 0 4 1
A getAddress2() 0 4 1
A getCity() 0 4 1
A getRegionId() 0 4 1
A getPostCode() 0 4 1
A getCountryId() 0 4 1
A setCompany() 0 4 1
A setAddress() 0 4 1
A setAddress2() 0 4 1
A setCity() 0 4 1
A setRegionId() 0 4 1
A setPostCode() 0 4 1
A setCountryId() 0 4 1
A getFirstName() 0 4 1
A getLastName() 0 4 1
A setFirstName() 0 4 1
A setLastName() 0 4 1
A generateUniqueEmailAddress() 0 13 3

How to fix   Complexity   

Complex Class

Complex classes like Customer often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use Customer, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
namespace Magium\Magento\Identities;
4
5
use Magium\Identities\AddressInterface;
6
use Magium\Identities\EmailInterface;
7
use Magium\Identities\NameInterface;
8
use Magium\Util\EmailGenerator\Generator;
9
use Magium\Util\EmailGenerator\GeneratorAware;
10
11
class Customer extends AbstractEntity implements GeneratorAware, NameInterface, EmailInterface, AddressInterface
12
{
13
    const IDENTITY = 'Customer';
14
15
    public $emailAddress          = '[email protected]';
16
17
    public $billingFirstName        = 'Kevin';
18
    public $billingLastName         = 'Schroeder';
19
    public $billingCompany          = '';
20
    public $billingAddress          = '10451 Jefferson Blvd';
21
    public $billingAddress2         = '';
22
    public $billingCity             = 'Culver City';
23
    public $billingRegionId         = 'California';
24
    public $billingPostCode         = '90232';
25
    public $billingCountryId        = 'US';
26
    public $billingTelephone        = '123-123-1234';
27
    public $billingFax              = '';
28
29
    public $shippingFirstName        = 'Kevin';
30
    public $shippingLastName         = 'Schroeder';
31
    public $shippingCompany          = '';
32
    public $shippingAddress          = '10451 Jefferson Blvd';
33
    public $shippingAddress2         = '';
34
    public $shippingCity             = 'Culver City';
35
    public $shippingRegionId         = 'California';
36
    public $shippingPostCode         = '90232';
37
    public $shippingCountryId        = 'US';
38
    public $shippingTelephone        = '123-123-1234';
39
    public $shippingFax              = '';
40
41
    protected $uniqueEmailAddressGenerated = false;
42
    protected $generator;
43
44
    public function setGenerator(Generator $generator)
45
    {
46
        $this->generator = $generator;
47
    }
48
49
    public function getCompany()
50
    {
51
        return $this->getBillingCompany();
52
    }
53
54
    public function getAddress()
55
    {
56
        return $this->getBillingAddress();
57
    }
58
59
    public function getAddress2()
60
    {
61
        return $this->getBillingAddress2();
62
    }
63
64
    public function getCity()
65
    {
66
        return $this->getBillingCity();
67
    }
68
69
    public function getRegionId()
70
    {
71
        return $this->getBillingRegionId();
72
    }
73
74
    public function getPostCode()
75
    {
76
        return $this->getBillingPostCode();
77
    }
78
79
    public function getCountryId()
80
    {
81
        return $this->getBillingCountryId();
82
    }
83
84
    public function setCompany($value)
85
    {
86
        $this->setBillingCompany($value);
87
    }
88
89
    public function setAddress($value)
90
    {
91
        $this->setBillingAddress($value);
92
    }
93
94
    public function setAddress2($value)
95
    {
96
        $this->setBillingAddress2($value);
97
    }
98
99
    public function setCity($value)
100
    {
101
        $this->setBillingCity($value);
102
    }
103
104
    public function setRegionId($value)
105
    {
106
        $this->setBillingRegionId($value);
107
    }
108
109
    public function setPostCode($value)
110
    {
111
        $this->setBillingPostCode($value);
112
    }
113
114
    public function setCountryId($value)
115
    {
116
        $this->setBillingCountryId($value);
117
    }
118
119
    public function getFirstName()
120
    {
121
        return $this->getBillingFirstName();
122
    }
123
124
    public function getLastName()
125
    {
126
        return $this->getBillingLastName();
127
    }
128
129
    public function setFirstName($value)
130
    {
131
        $this->setBillingFirstName($value);
132
    }
133
134
    public function setLastName($value)
135
    {
136
        $this->setBillingLastName($value);
137
    }
138
139
140
    public function generateUniqueEmailAddress($domain = 'example.com')
141
    {
142
        if ($this->generator instanceof NameInterface) {
143
            $this->generator->setFirstName($this->getFirstName());
144
            $this->generator->setLastName($this->getLastName());
145
        }
146
        if ($this->generator instanceof EmailInterface) {
147
            $this->generator->setEmailAddress($this->getEmailAddress());
148
        }
149
        $this->uniqueEmailAddressGenerated = true;
150
        $this->emailAddress = $this->generator->generate($domain);
151
        return $this->emailAddress;
152
    }
153
154
    /**
155
     * @return boolean
156
     */
157
    public function isUniqueEmailAddressGenerated()
158
    {
159
        return $this->uniqueEmailAddressGenerated;
160
    }
161
162
    /**
163
     * @param boolean $uniqueEmailAddressGenerated
164
     */
165
    public function setUniqueEmailAddressGenerated($uniqueEmailAddressGenerated)
166
    {
167
        $this->uniqueEmailAddressGenerated = $uniqueEmailAddressGenerated;
168
    }
169
170
    /**
171
     * @return string
172
     */
173
    public function getBillingFirstName()
174
    {
175
        return $this->billingFirstName;
176
    }
177
178
    /**
179
     * @param string $billingFirstName
180
     */
181
    public function setBillingFirstName($billingFirstName)
182
    {
183
        $this->billingFirstName = $billingFirstName;
184
    }
185
186
    /**
187
     * @return string
188
     */
189
    public function getBillingLastName()
190
    {
191
        return $this->billingLastName;
192
    }
193
194
    /**
195
     * @param string $billingLastName
196
     */
197
    public function setBillingLastName($billingLastName)
198
    {
199
        $this->billingLastName = $billingLastName;
200
    }
201
202
    /**
203
     * @return string
204
     */
205
    public function getBillingCompany()
206
    {
207
        return $this->billingCompany;
208
    }
209
210
    /**
211
     * @param string $billingCompany
212
     */
213
    public function setBillingCompany($billingCompany)
214
    {
215
        $this->billingCompany = $billingCompany;
216
    }
217
218
    /**
219
     * @return string
220
     */
221
    public function getEmailAddress()
222
    {
223
        return $this->emailAddress;
224
    }
225
226
    /**
227
     * @param string $emailAddress
228
     */
229
    public function setEmailAddress($emailAddress)
230
    {
231
        $this->emailAddress = $emailAddress;
232
    }
233
234
235
236
    /**
237
     * @return string
238
     */
239
    public function getBillingAddress()
240
    {
241
        return $this->billingAddress;
242
    }
243
244
    /**
245
     * @param string $billingAddress
246
     */
247
    public function setBillingAddress($billingAddress)
248
    {
249
        $this->billingAddress = $billingAddress;
250
    }
251
252
    /**
253
     * @return string
254
     */
255
    public function getBillingAddress2()
256
    {
257
        return $this->billingAddress2;
258
    }
259
260
    /**
261
     * @param string $billingAddress2
262
     */
263
    public function setBillingAddress2($billingAddress2)
264
    {
265
        $this->billingAddress2 = $billingAddress2;
266
    }
267
268
    /**
269
     * @return string
270
     */
271
    public function getBillingCity()
272
    {
273
        return $this->billingCity;
274
    }
275
276
    /**
277
     * @param string $billingCity
278
     */
279
    public function setBillingCity($billingCity)
280
    {
281
        $this->billingCity = $billingCity;
282
    }
283
284
    /**
285
     * @return string
286
     */
287
    public function getBillingRegionId()
288
    {
289
        return $this->billingRegionId;
290
    }
291
292
    /**
293
     * @param string $billingRegionId
294
     */
295
    public function setBillingRegionId($billingRegionId)
296
    {
297
        $this->billingRegionId = $billingRegionId;
298
    }
299
300
    /**
301
     * @return string
302
     */
303
    public function getBillingPostCode()
304
    {
305
        return $this->billingPostCode;
306
    }
307
308
    /**
309
     * @param string $billingPostCode
310
     */
311
    public function setBillingPostCode($billingPostCode)
312
    {
313
        $this->billingPostCode = $billingPostCode;
314
    }
315
316
    /**
317
     * @return string
318
     */
319
    public function getBillingCountryId()
320
    {
321
        return $this->billingCountryId;
322
    }
323
324
    /**
325
     * @param string $billingCountryId
326
     */
327
    public function setBillingCountryId($billingCountryId)
328
    {
329
        $this->billingCountryId = $billingCountryId;
330
    }
331
332
    /**
333
     * @return string
334
     */
335
    public function getBillingTelephone()
336
    {
337
        return $this->billingTelephone;
338
    }
339
340
    /**
341
     * @param string $billingTelephone
342
     */
343
    public function setBillingTelephone($billingTelephone)
344
    {
345
        $this->billingTelephone = $billingTelephone;
346
    }
347
348
    /**
349
     * @return string
350
     */
351
    public function getBillingFax()
352
    {
353
        return $this->billingFax;
354
    }
355
356
    /**
357
     * @param string $billingFax
358
     */
359
    public function setBillingFax($billingFax)
360
    {
361
        $this->billingFax = $billingFax;
362
    }
363
364
    /**
365
     * @return string
366
     */
367
    public function getShippingFirstName()
368
    {
369
        return $this->shippingFirstName;
370
    }
371
372
    /**
373
     * @param string $shippingFirstName
374
     */
375
    public function setShippingFirstName($shippingFirstName)
376
    {
377
        $this->shippingFirstName = $shippingFirstName;
378
    }
379
380
    /**
381
     * @return string
382
     */
383
    public function getShippingLastName()
384
    {
385
        return $this->shippingLastName;
386
    }
387
388
    /**
389
     * @param string $shippingLastName
390
     */
391
    public function setShippingLastName($shippingLastName)
392
    {
393
        $this->shippingLastName = $shippingLastName;
394
    }
395
396
    /**
397
     * @return string
398
     */
399
    public function getShippingCompany()
400
    {
401
        return $this->shippingCompany;
402
    }
403
404
    /**
405
     * @param string $shippingCompany
406
     */
407
    public function setShippingCompany($shippingCompany)
408
    {
409
        $this->shippingCompany = $shippingCompany;
410
    }
411
412
413
    /**
414
     * @return string
415
     */
416
    public function getShippingAddress()
417
    {
418
        return $this->shippingAddress;
419
    }
420
421
    /**
422
     * @param string $shippingAddress
423
     */
424
    public function setShippingAddress($shippingAddress)
425
    {
426
        $this->shippingAddress = $shippingAddress;
427
    }
428
429
    /**
430
     * @return string
431
     */
432
    public function getShippingAddress2()
433
    {
434
        return $this->shippingAddress2;
435
    }
436
437
    /**
438
     * @param string $shippingAddress2
439
     */
440
    public function setShippingAddress2($shippingAddress2)
441
    {
442
        $this->shippingAddress2 = $shippingAddress2;
443
    }
444
445
    /**
446
     * @return string
447
     */
448
    public function getShippingCity()
449
    {
450
        return $this->shippingCity;
451
    }
452
453
    /**
454
     * @param string $shippingCity
455
     */
456
    public function setShippingCity($shippingCity)
457
    {
458
        $this->shippingCity = $shippingCity;
459
    }
460
461
    /**
462
     * @return string
463
     */
464
    public function getShippingRegionId()
465
    {
466
        return $this->shippingRegionId;
467
    }
468
469
    /**
470
     * @param string $shippingRegionId
471
     */
472
    public function setShippingRegionId($shippingRegionId)
473
    {
474
        $this->shippingRegionId = $shippingRegionId;
475
    }
476
477
    /**
478
     * @return string
479
     */
480
    public function getShippingPostCode()
481
    {
482
        return $this->shippingPostCode;
483
    }
484
485
    /**
486
     * @param string $shippingPostCode
487
     */
488
    public function setShippingPostCode($shippingPostCode)
489
    {
490
        $this->shippingPostCode = $shippingPostCode;
491
    }
492
493
    /**
494
     * @return string
495
     */
496
    public function getShippingCountryId()
497
    {
498
        return $this->shippingCountryId;
499
    }
500
501
    /**
502
     * @param string $shippingCountryId
503
     */
504
    public function setShippingCountryId($shippingCountryId)
505
    {
506
        $this->shippingCountryId = $shippingCountryId;
507
    }
508
509
    /**
510
     * @return string
511
     */
512
    public function getShippingTelephone()
513
    {
514
        return $this->shippingTelephone;
515
    }
516
517
    /**
518
     * @param string $shippingTelephone
519
     */
520
    public function setShippingTelephone($shippingTelephone)
521
    {
522
        $this->shippingTelephone = $shippingTelephone;
523
    }
524
525
    /**
526
     * @return string
527
     */
528
    public function getShippingFax()
529
    {
530
        return $this->shippingFax;
531
    }
532
533
    /**
534
     * @param string $shippingFax
535
     */
536
    public function setShippingFax($shippingFax)
537
    {
538
        $this->shippingFax = $shippingFax;
539
    }
540
541
542
543
}