Passed
Push — master ( 335c74...ca5aae )
by Pierre
02:52
created

TimeInTransitResponse   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 99
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 13
lcom 0
cbo 5
dl 0
loc 99
ccs 0
cts 29
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
F __construct() 0 43 13
1
<?php
2
3
namespace Ups\Entity;
4
5
class TimeInTransitResponse
6
{
7
    /**
8
     * @var
9
     */
10
    public $PickupDate;
11
12
    /**
13
     * @var AddressArtifactFormat
14
     */
15
    public $TransitFrom;
16
17
    /**
18
     * @var AddressArtifactFormat
19
     */
20
    public $TransitTo;
21
22
    /**
23
     * @var
24
     */
25
    public $DocumentsOnlyIndicator;
26
27
    /**
28
     * @var
29
     */
30
    public $AutoDutyCode;
31
32
    /**
33
     * @var ShipmentWeight
34
     */
35
    public $ShipmentWeight;
36
37
    /**
38
     * @var Charges
39
     */
40
    public $InvoiceLineTotal;
41
42
    /**
43
     * @var
44
     */
45
    public $Disclaimer;
46
47
    /**
48
     * @var array
49
     */
50
    public $ServiceSummary;
51
52
    /**
53
     * @var
54
     */
55
    public $MaximumListSize;
56
57
    /**
58
     * @param \stdClass|null $response
59
     */
60
    public function __construct(\stdClass $response = null)
61
    {
62
        $this->TransitFrom = new Address();
63
        $this->TransitTo = new Address();
64
        $this->ShipmentWeight = new ShipmentWeight();
65
        $this->InvoiceLineTotal = new Charges();
66
        $this->ServiceSummary = [];
67
68
        if (null !== $response) {
69
            if (isset($response->PickupDate)) {
70
                $this->PickupDate = $response->PickupDate;
71
            }
72
            if (isset($response->TransitFrom->AddressArtifactFormat)) {
73
                $this->TransitFrom = new AddressArtifactFormat($response->TransitFrom->AddressArtifactFormat);
74
            }
75
            if (isset($response->TransitTo->AddressArtifactFormat)) {
76
                $this->TransitTo = new AddressArtifactFormat($response->TransitTo->AddressArtifactFormat);
77
            }
78
            if (isset($response->DocumentsOnlyIndicator)) {
79
                $this->DocumentsOnlyIndicator = $response->DocumentsOnlyIndicator;
80
            }
81
            if (isset($response->AutoDutyCode)) {
82
                $this->AutoDutyCode = $response->AutoDutyCode;
83
            }
84
            if (isset($response->ShipmentWeight)) {
85
                $this->ShipmentWeight = new ShipmentWeight($response->ShipmentWeight);
86
            }
87
            if (isset($response->InvoiceLineTotal)) {
88
                $this->InvoiceLineTotal = new Charges($response->InvoiceLineTotal);
89
            }
90
            if (isset($response->Disclaimer)) {
91
                $this->Disclaimer = $response->Disclaimer;
92
            }
93
            if (isset($response->ServiceSummary)) {
94
                foreach ($response->ServiceSummary as $serviceSummary) {
95
                    $this->ServiceSummary[] = new ServiceSummary($serviceSummary);
96
                }
97
            }
98
            if (isset($response->MaximumListSize)) {
99
                $this->MaximumListSize = $response->MaximumListSize;
100
            }
101
        }
102
    }
103
}
104