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

EstimatedArrival   A

Complexity

Total Complexity 17

Size/Duplication

Total Lines 123
Duplicated Lines 17.07 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 44.44%

Importance

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

11 Methods

Rating   Name   Duplication   Size   Complexity  
A getBusinessTransitDays() 0 4 1
A setBusinessTransitDays() 0 4 1
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 getDate() 0 4 1
B __construct() 21 21 7
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
6
{
7
    use EstimatedArrivalTrait;
8
9
    const EA_MONDAY = 'MON';
10
    const EA_TUESDAY = 'TUE';
11
    const EA_WEDNESDAY = 'WEB';
12
    const EA_THUSDAY = 'THU';
13
    const EA_FRIDAY = 'FRI';
14
    const EA_SATURDAY = 'SAT';
15
    // Sunday is an invalid day :-)
16
17
    private $BusinessTransitDays;
18
    private $Time;
19
    private $PickupDate;
20
    private $PickupTime;
21
    private $Date;
22
23
    /**
24
     * @param \stdClass|null $response
25
     */
26 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...
27
    {
28 5
        if (null !== $response) {
29 3
            $this->build($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->Date)) {
43 3
                $this->Date = $response->Date;
44 3
            }
45 3
        }
46 5
    }
47
48
    /**
49
     * @return string
50
     */
51
    public function getBusinessTransitDays()
52
    {
53
        return $this->BusinessTransitDays;
54
    }
55
56
    /**
57
     * @param string $BusinessTransitDays
58
     */
59
    public function setBusinessTransitDays($BusinessTransitDays)
60
    {
61
        $this->BusinessTransitDays = $BusinessTransitDays;
62
    }
63
64
    /**
65
     * @return string
66
     */
67
    public function getTime()
68
    {
69
        return $this->Time;
70
    }
71
72
    /**
73
     * @param string $Time
74
     */
75
    public function setTime($Time)
76
    {
77
        $this->Time = $Time;
78
    }
79
80
    /**
81
     * @return string
82
     */
83
    public function getPickupDate()
84
    {
85
        return $this->PickupDate;
86
    }
87
88
    /**
89
     * @param string $PickupDate
90
     */
91
    public function setPickupDate($PickupDate)
92
    {
93
        $this->PickupDate = $PickupDate;
94
    }
95
96
    /**
97
     * @return string
98
     */
99
    public function getPickupTime()
100
    {
101
        return $this->PickupTime;
102
    }
103
104
    /**
105
     * @param string $PickupTime
106
     */
107
    public function setPickupTime($PickupTime)
108
    {
109
        $this->PickupTime = $PickupTime;
110
    }
111
112
    /**
113
     * @return string
114
     */
115
    public function getDate()
116
    {
117
        return $this->Date;
118
    }
119
120
    /**
121
     * @param string $Date
122
     */
123
    public function setDate($Date)
124
    {
125
        $this->Date = $Date;
126
    }
127
}
128