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

RateTimeInTransitResponse   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 58
Duplicated Lines 37.93 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
c 1
b 0
f 0
lcom 0
cbo 1
dl 22
loc 58
ccs 0
cts 20
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
C __construct() 22 22 7

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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