TextTransformer::doMap()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 9
ccs 0
cts 7
cp 0
crap 6
rs 10
1
<?php
2
/**
3
 * @author Muhammed Akbulut <[email protected]>
4
 * @copyright Zicht Online <http://www.zicht.nl>
5
 */
6
7
namespace Zicht\Bundle\UrlBundle\Form\DataTransformer;
8
9
use Symfony\Component\Form\DataTransformerInterface;
10
11
/**
12
 * Class TextTransformer
13
 *
14
 * @package Zicht\Bundle\UrlBundle\Form\DataTransformer
15
 */
16
class TextTransformer extends AbstractAliasingTransformer
17
{
18
    /**
19
     * Delegates the text mapping to the aliasing service.
20
     *
21
     * @param string $text
22
     * @param string $mode
23
     * @return mixed|null
24
     */
25
    protected function doMap($text, $mode)
26
    {
27
        $map = $this->aliasing->getAliasingMap([$text], $mode);
28
29
        if (count($map) === 1) {
30
            return current($map);
31
        }
32
        
33
        return $text;
34
    }
35
}
36