Test Failed
Pull Request — master (#192)
by
unknown
03:49
created

ServiceSummary   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 39
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
lcom 0
cbo 2
dl 39
loc 39
ccs 0
cts 14
cp 0
rs 10
c 1
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 12 12 3
A getEstimatedArrival() 4 4 1
A setEstimatedArrival() 4 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\RateTimeInTransit;
4
5
use Ups\Entity\ServiceSummaryTrait;
6
7 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...
8
{
9
    use ServiceSummaryTrait;
10
11
    /** @var  \Ups\Entity\TimeInTransit\EstimatedArrival */
12
    protected $estimatedArrival;
13
14
    /**
15
     * @param \stdClass|null $response
16
     */
17
    public function __construct(\stdClass $response = null)
18
    {
19
        self::build($response);
20
21
        $this->setEstimatedArrival(new EstimatedArrival());
22
23
        if (null !== $response) {
24
            if (isset($response->EstimatedArrival)) {
25
                $this->setEstimatedArrival(new EstimatedArrival($response->EstimatedArrival));
26
            }
27
        }
28
    }
29
30
    /**
31
     * @return \Ups\Entity\RateTimeInTransit\EstimatedArrival
32
     */
33
    public function getEstimatedArrival()
34
    {
35
        return $this->estimatedArrival;
36
    }
37
38
    /**
39
     * @param \Ups\Entity\RateTimeInTransit\EstimatedArrival
40
     */
41
    public function setEstimatedArrival(EstimatedArrival $estimatedArrival)
42
    {
43
        $this->estimatedArrival = $estimatedArrival;
0 ignored issues
show
Documentation Bug introduced by
It seems like $estimatedArrival of type object<Ups\Entity\RateTi...ansit\EstimatedArrival> is incompatible with the declared type object<Ups\Entity\TimeInTransit\EstimatedArrival> of property $estimatedArrival.

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...
44
    }
45
}
46