Passed
Pull Request — master (#193)
by Stefan
02:31
created

ServiceSummary   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 43
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 86.67%

Importance

Changes 0
Metric Value
wmc 5
c 0
b 0
f 0
lcom 0
cbo 2
dl 43
loc 43
ccs 13
cts 15
cp 0.8667
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getEstimatedArrival() 4 4 1
A setEstimatedArrival() 5 5 1
A __construct() 12 12 3

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 View Code Duplication
class ServiceSummary
0 ignored issues
show
Duplication introduced by
This class 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...
6
{
7
    use ServiceSummaryTrait;
8
9
    /** @deprecated */
10
    public $EstimatedArrival;
11
12
    /** @var  \Ups\Entity\EstimatedArrival */
13
    protected $estimatedArrival;
14
15
    /**
16
     * @param \stdClass|null $response
17
     */
18 4
    public function __construct(\stdClass $response = null)
19
    {
20 4
        $this->build($response);
21
        
22 4
        $this->setEstimatedArrival(new EstimatedArrival());
23
24 4
        if (null !== $response) {
25 3
            if (isset($response->EstimatedArrival)) {
26 3
                $this->setEstimatedArrival(new EstimatedArrival($response->EstimatedArrival));
27 3
            }
28 3
        }
29 4
    }
30
31
    /**
32
     * @return \Ups\Entity\EstimatedArrival
33
     */
34
    public function getEstimatedArrival()
35
    {
36
        return $this->estimatedArrival;
37
    }
38
39
    /**
40
     * @param \Ups\Entity\EstimatedArrival
41
     */
42 4
    public function setEstimatedArrival(EstimatedArrival $estimatedArrival)
43
    {
44 4
        $this->EstimatedArrival = $estimatedArrival;
0 ignored issues
show
Deprecated Code introduced by
The property Ups\Entity\ServiceSummary::$EstimatedArrival has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
45 4
        $this->estimatedArrival = $estimatedArrival;
46 4
    }
47
}
48