Extension::getTokenParsers()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
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
declare(strict_types=1);
18
19
namespace Phpfastcache\Bundle\Twig\CacheExtension;
20
21
/**
22
 * Extension for caching template blocks with twig.
23
 *
24
 * @author Alexander <[email protected]>
25
 */
26
class Extension extends \Twig_Extension
27
{
28
    private $cacheStrategy;
29
30
    /**
31
     * @param CacheStrategyInterface $cacheStrategy
32
     */
33
    public function __construct(CacheStrategyInterface $cacheStrategy)
34
    {
35
        $this->cacheStrategy = $cacheStrategy;
36
    }
37
38
    /**
39
     * @return CacheStrategyInterface
40
     */
41
    public function getCacheStrategy()
42
    {
43
        return $this->cacheStrategy;
44
    }
45
46
    /**
47
     * {@inheritDoc}
48
     */
49
    public function getName()
50
    {
51
        if (\version_compare(\Twig_Environment::VERSION, '1.26.0', '>=')) {
52
            return \get_class($this);
53
        }
54
        return 'phpfastcache_cache';
55
    }
56
57
    /**
58
     * {@inheritDoc}
59
     */
60
    public function getTokenParsers()
61
    {
62
        return [
63
          new TokenParser\Cache(),
64
        ];
65
    }
66
}
67