CountryTransformer   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 5
c 0
b 0
f 0
dl 0
loc 14
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A input() 0 7 2
A output() 0 3 2
1
<?php
2
3
namespace Bone\User\Form\Transformer;
4
5
use Del\Entity\Country;
6
use Del\Factory\CountryFactory;
7
use Del\Form\Field\TransformerInterface;
8
9
class CountryTransformer implements TransformerInterface
10
{
11 2
    public function input($data): string
12
    {
13 2
        if ($data instanceof Country) {
14 1
            return $data->getIso();
15
        }
16
17 2
        return $data;
18
    }
19
20 1
    public function output(string $value)
21
    {
22 1
        return empty($value) ? '' : CountryFactory::generate($value);
23
    }
24
25
}