Passed
Push — master ( 2b63db...3a2bd9 )
by Stefan
07:15
created

EstimatedArrival::__construct()   F

Complexity

Conditions 13
Paths 2049

Size

Total Lines 38
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 37
CRAP Score 13

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 38
ccs 37
cts 37
cp 1
rs 2.7716
cc 13
eloc 24
nc 2049
nop 1
crap 13

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace Ups\Entity;
4
5
class EstimatedArrival
6
{
7
    const EA_MONDAY = 'MON';
8
    const EA_TUESDAY = 'TUE';
9
    const EA_WEDNESDAY = 'WEB';
10
    const EA_THUSDAY = 'THU';
11
    const EA_FRIDAY = 'FRI';
12
    const EA_SATURDAY = 'SAT';
13
    // Sunday is an invalid day :-)
14
15
    public $BusinessTransitDays;
16
    public $Time;
17
    public $PickupDate;
18
    public $PickupTime;
19
    public $HolidayCount;
20
    public $DelayCount;
21
    public $Date;
22
    public $DayOfWeek;
23
    public $TotalTransitDays;
24
    public $CustomerCenterCutoff;
25
    public $RestDays;
26
27 3
    public function __construct($response = null)
28
    {
29 3
        if (null != $response) {
30 3
            if (isset($response->BusinessTransitDays)) {
31 3
                $this->BusinessTransitDays = $response->BusinessTransitDays;
32 3
            }
33 3
            if (isset($response->Time)) {
34 3
                $this->Time = $response->Time;
35 3
            }
36 3
            if (isset($response->PickupDate)) {
37 3
                $this->PickupDate = $response->PickupDate;
38 3
            }
39 3
            if (isset($response->PickupTime)) {
40 3
                $this->PickupTime = $response->PickupTime;
41 3
            }
42 3
            if (isset($response->HolidayCount)) {
43 3
                $this->HolidayCount = $response->HolidayCount;
44 3
            }
45 3
            if (isset($response->DelayCount)) {
46 3
                $this->DelayCount = $response->DelayCount;
47 3
            }
48 3
            if (isset($response->Date)) {
49 3
                $this->Date = $response->Date;
50 3
            }
51 3
            if (isset($response->DayOfWeek)) {
52 3
                $this->DayOfWeek = $response->DayOfWeek;
53 3
            }
54 3
            if (isset($response->TotalTransitDays)) {
55 3
                $this->TotalTransitDays = $response->TotalTransitDays;
56 3
            }
57 3
            if (isset($response->CustomerCenterCutoff)) {
58 3
                $this->CustomerCenterCutoff = $response->CustomerCenterCutoff;
59 3
            }
60 3
            if (isset($response->RestDays)) {
61 3
                $this->RestDays = $response->RestDays;
62 3
            }
63 3
        }
64 3
    }
65
}
66