CountryTransformer::output()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 2
nc 2
nop 1
crap 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
}