Failed Conditions
Pull Request — master (#790)
by Guilherme
05:12
created

RsExtension   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 37
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A getFilters() 0 4 1
A __construct() 0 3 1
A getPersonRS() 0 3 1
1
<?php
2
/**
3
 * This file is part of the login-cidadao project or it's bundles.
4
 *
5
 * (c) Guilherme Donato <guilhermednt on github>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace PROCERGS\LoginCidadao\CoreBundle\Twig\Extension;
12
13
use LoginCidadao\CoreBundle\Model\PersonInterface;
14
use PROCERGS\LoginCidadao\CoreBundle\Helper\MeuRSHelper;
15
16
class RsExtension extends \Twig_Extension
17
{
18
    /** @var MeuRSHelper */
19
    private $rsHelper;
20
21
    /**
22
     * RsExtension constructor.
23
     * @param MeuRSHelper $rsHelper
24
     */
25 1
    public function __construct(MeuRSHelper $rsHelper)
26
    {
27 1
        $this->rsHelper = $rsHelper;
28 1
    }
29
30
    /**
31
     * @return array|\Twig_SimpleFilter[]
32
     */
33 1
    public function getFilters()
34
    {
35
        return [
36 1
            new \Twig_SimpleFilter('personRS', [$this, 'getPersonRS']),
37
        ];
38
    }
39
40 1
    public function getPersonRS(PersonInterface $person)
41
    {
42 1
        return $this->rsHelper->getPersonMeuRS($person);
43
    }
44
45
    /**
46
     * Returns the name of the extension.
47
     *
48
     * @return string The extension name
49
     */
50 1
    public function getName()
51
    {
52 1
        return 'person_rs_twig_extension';
53
    }
54
}
55