TextTransformer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 5
c 2
b 1
f 0
dl 0
loc 18
ccs 0
cts 7
cp 0
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A doMap() 0 9 2
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