HasCountryTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 7
c 2
b 0
f 0
dl 0
loc 15
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getCountry() 0 3 1
A setCountry() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Del\Traits;
6
7
use Bone\BoneDoctrine\Attributes\Visibility;
0 ignored issues
show
Bug introduced by
The type Bone\BoneDoctrine\Attributes\Visibility was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Del\Entity\Country;
9
use Del\Factory\CountryFactory;
10
use Del\Form\Field\Attributes\Field;
11
use Del\Form\Field\CountrySelect;
12
use Doctrine\ORM\Mapping as ORM;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\Mapping was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
14
trait HasCountryTrait
15
{
16
    #[ORM\Column(type: 'string', length:3, nullable: false)]
17
    #[Field(rules: 'custom', fieldClass: CountrySelect::class)]
18
    #[Visibility('all')]
19
    private string $country;
20
21
    public function getCountry(): Country
22
    {
23
        return CountryFactory::generate($this->country);
24
    }
25
26
    public function setCountry(Country $country): void
27
    {
28
        $this->country = $country->getIso();
29
    }
30
}
31