Completed
Push — master ( c8fd93...a9ab00 )
by Georges
01:49
created

Extension::getTokenParsers()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
/**
4
 *
5
 * This file is part of phpFastCache.
6
 *
7
 * @license MIT License (MIT)
8
 *
9
 * For full copyright and license information, please see the docs/CREDITS.txt file.
10
 *
11
 * @author Georges.L (Geolim4)  <[email protected]>
12
 * @author PastisD https://github.com/PastisD
13
 * @author Alexander (asm89) <[email protected]>
14
 * @author Khoa Bui (khoaofgod)  <[email protected]> http://www.phpfastcache.com
15
 *
16
 */
17
18
namespace phpFastCache\Bundle\Twig\CacheExtension;
19
20
/**
21
 * Extension for caching template blocks with twig.
22
 *
23
 * @author Alexander <[email protected]>
24
 */
25
class Extension extends \Twig_Extension
26
{
27
    private $cacheStrategy;
28
29
    /**
30
     * @param CacheStrategyInterface $cacheStrategy
31
     */
32
    public function __construct(CacheStrategyInterface $cacheStrategy)
33
    {
34
        $this->cacheStrategy = $cacheStrategy;
35
    }
36
37
    /**
38
     * @return CacheStrategyInterface
39
     */
40
    public function getCacheStrategy()
41
    {
42
        return $this->cacheStrategy;
43
    }
44
45
    /**
46
     * {@inheritDoc}
47
     */
48
    public function getName()
49
    {
50
        if (version_compare(\Twig_Environment::VERSION, '1.26.0', '>=')) {
51
            return get_class($this);
52
        }
53
        return 'asm89_cache';
54
    }
55
56
    /**
57
     * {@inheritDoc}
58
     */
59
    public function getTokenParsers()
60
    {
61
        return array(
62
            new TokenParser\Cache(),
63
        );
64
    }
65
}
66