Passed
Push — master ( 17c5f7...cb633b )
by Stefan
04:29 queued 02:00
created

RateTimeInTransitResponse::__construct()   C

Complexity

Conditions 7
Paths 33

Size

Total Lines 22
Code Lines 13

Duplication

Lines 22
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 56

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 22
loc 22
ccs 0
cts 20
cp 0
rs 6.9811
cc 7
eloc 13
nc 33
nop 1
crap 56
1
<?php
2
3
namespace Ups\Entity;
4
5
use Ups\Entity\RateTimeInTransit\ServiceSummary as RateTimeInTransitServiceSummary;
6
7
class RateTimeInTransitResponse
8
{
9
    /**
10
     * @var string
11
     */
12
    public $PickupDate;
13
14
    /**
15
     * @var string
16
     */
17
    public $DocumentsOnlyIndicator;
18
19
    /**
20
     * @var string
21
     */
22
    public $PackageBillType;
23
24
    /**
25
     * @var ServiceSummary
26
     */
27
    public $ServiceSummary;
28
29
    /**
30
     * @var string
31
     */
32
    public $AutoDutyCode;
33
34
    /**
35
     * @var string
36
     */
37
    public $Disclaimer;
38
39
    /**
40
     * @param \stdClass|null $response
41
     */
42 View Code Duplication
    public function __construct(\stdClass $response = null)
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...
43
    {
44
        $this->ServiceSummary = [];
0 ignored issues
show
Documentation Bug introduced by
It seems like array() of type array is incompatible with the declared type object<Ups\Entity\ServiceSummary> of property $ServiceSummary.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
45
46
        if (null !== $response) {
47
            if (isset($response->PickupDate)) {
48
                $this->PickupDate = $response->PickupDate;
49
            }
50
            if (isset($response->DocumentsOnlyIndicator)) {
51
                $this->DocumentsOnlyIndicator = $response->DocumentsOnlyIndicator;
52
            }
53
            if (isset($response->AutoDutyCode)) {
54
                $this->AutoDutyCode = $response->AutoDutyCode;
55
            }
56
            if (isset($response->Disclaimer)) {
57
                $this->Disclaimer = $response->Disclaimer;
58
            }
59
            if (isset($response->ServiceSummary)) {
60
                $this->ServiceSummary = new RateTimeInTransitServiceSummary($response->ServiceSummary);
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Ups\Entity\RateTime...sponse->ServiceSummary) of type object<Ups\Entity\RateTi...Transit\ServiceSummary> is incompatible with the declared type object<Ups\Entity\ServiceSummary> of property $ServiceSummary.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
61
            }
62
        }
63
    }
64
}
65