Completed
Pull Request — master (#15)
by Emanuele
04:39
created

FeatureExtension::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Ae\FeatureBundle\Twig\Extension;
4
5
use Ae\FeatureBundle\Service\Feature;
6
use Ae\FeatureBundle\Twig\TokenParser\FeatureTokenParser;
7
use Twig_Extension;
8
9
/**
10
 * @author Carlo Forghieri <[email protected]>
11
 */
12
class FeatureExtension extends Twig_Extension
13
{
14
    /**
15
     * @var Feature
16
     */
17
    protected $service;
18
19
    /**
20
     * @param Feature $service
21
     */
22
    public function __construct(Feature $service)
23
    {
24
        $this->service = $service;
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function getTokenParsers()
31
    {
32
        return [
33
            new FeatureTokenParser(),
34
        ];
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function getName()
41
    {
42
        return 'feature';
43
    }
44
45
    /**
46
     * @param string $name
47
     * @param string $parent
48
     *
49
     * @return bool
50
     */
51
    public function isGranted($name, $parent)
52
    {
53
        return $this->service->isGranted($name, $parent);
54
    }
55
}
56