Completed
Pull Request — master (#2)
by
unknown
02:02
created

HTML5CacheExtension::initRuntime()   A

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\HTML5CacheBundle\Twig;
4
5
/**
6
 * Class HTML5CacheExtension
7
 *
8
 * @package Evheniy\HTML5CacheBundle\Twig
9
 */
10
class HTML5CacheExtension extends \Twig_Extension
11
{
12
13
    /**
14
     * @return \Twig_SimpleFunction[]
15
     */
16
    public function getFunctions()
17
    {
18
      return [
19
                 new \Twig_SimpleFunction('cache_manifest', [$this, 'getCacheManifest'], [
20
                     'needs_environment' => true
21
                 ])
22
             ];
23
    }
24
25
    /**
26
     * @return string
27
     */
28
    public function getCacheManifest(\Twig_Environment $environment)
29
    {
30
        return $environment->isDebug() ? '' : ' manifest="/cache.manifest"';
31
    }
32
33
    /**
34
     * Returns the name of the extension.
35
     *
36
     * @return string The extension name
37
     */
38
    public function getName()
39
    {
40
        return 'html5_cache_extension';
41
    }
42
}
43