Test Failed
Pull Request — release/3.x (#37)
by
unknown
07:22
created

TextTransformer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 10
c 0
b 0
f 0
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