Passed
Push — master ( 331013...49242a )
by Derek Stephen
04:04
created

CountryTransformer::output()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 2
nc 2
nop 1
crap 6
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 1
    public function input($data): string
12
    {
13 1
        if ($data instanceof Country) {
14
            return $data->getIso();
15
        }
16
17 1
        return $data;
18
    }
19
20
    public function output(string $value)
21
    {
22
        return empty($value) ? '' : CountryFactory::generate($value);
23
    }
24
25
}