Project

General

Profile

1
<?php
2

    
3
/*
4
 * This file is part of Twig.
5
 *
6
 * (c) 2009 Fabien Potencier
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

    
12
/**
13
 * Interface implemented by extension classes.
14
 *
15
 * @package    twig
16
 * @author     Fabien Potencier <fabien@symfony.com>
17
 */
18
interface Twig_ExtensionInterface
19
{
20
    /**
21
     * Initializes the runtime environment.
22
     *
23
     * This is where you can load some file that contains filter functions for instance.
24
     *
25
     * @param Twig_Environment $environment The current Twig_Environment instance
26
     */
27
    function initRuntime(Twig_Environment $environment);
28

    
29
    /**
30
     * Returns the token parser instances to add to the existing list.
31
     *
32
     * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances
33
     */
34
    function getTokenParsers();
35

    
36
    /**
37
     * Returns the node visitor instances to add to the existing list.
38
     *
39
     * @return array An array of Twig_NodeVisitorInterface instances
40
     */
41
    function getNodeVisitors();
42

    
43
    /**
44
     * Returns a list of filters to add to the existing list.
45
     *
46
     * @return array An array of filters
47
     */
48
    function getFilters();
49

    
50
    /**
51
     * Returns a list of tests to add to the existing list.
52
     *
53
     * @return array An array of tests
54
     */
55
    function getTests();
56

    
57
    /**
58
     * Returns a list of functions to add to the existing list.
59
     *
60
     * @return array An array of functions
61
     */
62
    function getFunctions();
63

    
64
    /**
65
     * Returns a list of operators to add to the existing list.
66
     *
67
     * @return array An array of operators
68
     */
69
    function getOperators();
70

    
71
    /**
72
     * Returns a list of global variables to add to the existing list.
73
     *
74
     * @return array An array of global variables
75
     */
76
    function getGlobals();
77

    
78
    /**
79
     * Returns the name of the extension.
80
     *
81
     * @return string The extension name
82
     */
83
    function getName();
84
}
(9-9/33)