JqueryExtension::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Evheniy\JqueryBundle\Twig;
4
5
use Symfony\Component\DependencyInjection\ContainerInterface;
6
7
/**
8
 * Class JqueryExtension
9
 *
10
 * @package Evheniy\JqueryBundle\Twig
11
 */
12
class JqueryExtension extends \Twig_Extension implements \Twig_Extension_GlobalsInterface
13
{
14
    /**
15
     * @var \Symfony\Component\DependencyInjection\ContainerInterface
16
     */
17
    protected $container;
18
19
    /**
20
     * @param ContainerInterface $container
21
     */
22
    public function __construct(ContainerInterface $container)
23
    {
24
        $this->container = $container;
25
    }
26
27
    /**
28
     * @return array
29
     */
30
    public function getGlobals()
31
    {
32
        return array(
33
            'jquery' => $this->container->getParameter('jquery')
34
        );
35
    }
36
37
    /**
38
     * Returns the name of the extension.
39
     *
40
     * @return string The extension name
41
     */
42
    public function getName()
43
    {
44
        return 'jquery';
45
    }
46
}
47