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

RsExtension::getPersonRS()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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