Completed
Push — master ( ba33b0...227996 )
by Derek Stephen
05:32
created

HasCountryTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getCountry() 0 4 1
A setCountry() 0 4 1
1
<?php declare(strict_types=1);
2
3
namespace Del\Traits;
4
5
use Del\Entity\Country;
6
use Del\Factory\CountryFactory;
7
use Doctrine\ORM\Mapping as ORM;
8
9
trait HasCountryTrait
10
{
11
    /**
12
     * @var Country $country
13
     * @ORM\Column(type="string", length=3, nullable=false)
14
     */
15
    private $country;
16
17
    /**
18
     * @return Country
19
     */
20
    public function getCountry(): Country
21
    {
22
        return CountryFactory::generate($this->country);
23
    }
24
25
    /**
26
     * @param Country $country
27
     */
28
    public function setCountry(Country $country): void
29
    {
30
        $this->country = $country->getIso();
0 ignored issues
show
Documentation Bug introduced by
It seems like $country->getIso() of type string is incompatible with the declared type object<Del\Entity\Country> of property $country.

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...
31
    }
32
}
33