Completed
Push — master ( e52a1e...5c6bea )
by Daniel
02:19
created

LocationWithState   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 2
dl 32
loc 32
ccs 8
cts 8
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 6 6 1
A getState() 4 4 1
A getLocation() 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 Jobles\Core\Location;
4
5
use Phine\Country\CountryInterface;
6
use Phine\Country\SubdivisionInterface;
7
8 View Code Duplication
class LocationWithState extends Location implements LocationInterface
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...
9
{
10
    /**
11
     * @var SubdivisionInterface
12
     */
13
    private $state;
14
15 13
    public function __construct(CountryInterface $country, SubdivisionInterface $state)
16
    {
17 13
        parent::__construct($country);
18
19 13
        $this->state = $state;
20 13
    }
21
22
    /**
23
     * @return SubdivisionInterface
24
     */
25 1
    public function getState()
26
    {
27 1
        return $this->state;
28
    }
29
30
    /* LocationInterface */
31
32
    /**
33
     * @return string
34
     */
35 4
    public function getLocation()
36
    {
37 4
        return $this->state->getCode();
38
    }
39
}
40