Completed
Pull Request — master (#145)
by
unknown
03:13
created

EstimatedArrival   A

Complexity

Total Complexity 17

Size/Duplication

Total Lines 123
Duplicated Lines 17.89 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 44.44%

Importance

Changes 0
Metric Value
wmc 17
lcom 0
cbo 1
dl 22
loc 123
ccs 20
cts 45
cp 0.4444
rs 10
c 0
b 0
f 0

11 Methods

Rating   Name   Duplication   Size   Complexity  
C __construct() 22 22 7
A getTime() 0 4 1
A setTime() 0 4 1
A getPickupDate() 0 4 1
A setPickupDate() 0 4 1
A getPickupTime() 0 4 1
A setPickupTime() 0 4 1
A getDelayCount() 0 4 1
A setDelayCount() 0 4 1
A getDate() 0 4 1
A setDate() 0 4 1

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
class EstimatedArrival extends Rate\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
    private $Time;
16
    private $PickupDate;
17
    private $PickupTime;
18
    private $DelayCount;
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
19
    private $Date;
20
21
    /**
22
     * @param \stdClass|null $response
23
     */
24 5 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...
25
    {
26 5
        parent::__construct($response);
27
28 5
        if (null !== $response) {
29 3
            if (isset($response->Time)) {
30 3
                $this->Time = $response->Time;
31 3
            }
32 3
            if (isset($response->PickupDate)) {
33 3
                $this->PickupDate = $response->PickupDate;
34 3
            }
35 3
            if (isset($response->PickupTime)) {
36 3
                $this->PickupTime = $response->PickupTime;
37 3
            }
38 3
            if (isset($response->DelayCount)) {
39 3
                $this->DelayCount = $response->DelayCount;
40 3
            }
41 3
            if (isset($response->Date)) {
42 3
                $this->Date = $response->Date;
43 3
            }
44 3
        }
45 5
    }
46
47
    /**
48
     * @return mixed
49
     */
50
    public function getTime()
51
    {
52
        return $this->Time;
53
    }
54
55
    /**
56
     * @param mixed $Time
57
     */
58
    public function setTime($Time)
59
    {
60
        $this->Time = $Time;
61
    }
62
63
    /**
64
     * @return mixed
65
     */
66
    public function getPickupDate()
67
    {
68
        return $this->PickupDate;
69
    }
70
71
    /**
72
     * @param mixed $PickupDate
73
     */
74
    public function setPickupDate($PickupDate)
75
    {
76
        $this->PickupDate = $PickupDate;
77
    }
78
79
    /**
80
     * @return mixed
81
     */
82
    public function getPickupTime()
83
    {
84
        return $this->PickupTime;
85
    }
86
87
    /**
88
     * @param mixed $PickupTime
89
     */
90
    public function setPickupTime($PickupTime)
91
    {
92
        $this->PickupTime = $PickupTime;
93
    }
94
95
    /**
96
     * @return mixed
97
     */
98
    public function getDelayCount()
99
    {
100
        return $this->DelayCount;
101
    }
102
103
    /**
104
     * @param mixed $DelayCount
105
     */
106
    public function setDelayCount($DelayCount)
107
    {
108
        $this->DelayCount = $DelayCount;
109
    }
110
111
    /**
112
     * @return mixed
113
     */
114
    public function getDate()
115
    {
116
        return $this->Date;
117
    }
118
119
    /**
120
     * @param mixed $Date
121
     */
122
    public function setDate($Date)
123
    {
124
        $this->Date = $Date;
125
    }
126
127
}
128