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
 * @author Fabien Potencier <fabien@symfony.com>
16
 */
17
interface Twig_ExtensionInterface
18
{
19
    /**
20
     * Initializes the runtime environment.
21
     *
22
     * This is where you can load some file that contains filter functions for instance.
23
     *
24
     * @param Twig_Environment $environment The current Twig_Environment instance
25
     *
26
     * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_InitRuntimeInterface instead
27
     */
28
    public function initRuntime(Twig_Environment $environment);
29

    
30
    /**
31
     * Returns the token parser instances to add to the existing list.
32
     *
33
     * @return Twig_TokenParserInterface[]
34
     */
35
    public function getTokenParsers();
36

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

    
44
    /**
45
     * Returns a list of filters to add to the existing list.
46
     *
47
     * @return Twig_SimpleFilter[]
48
     */
49
    public function getFilters();
50

    
51
    /**
52
     * Returns a list of tests to add to the existing list.
53
     *
54
     * @return Twig_SimpleTest[]
55
     */
56
    public function getTests();
57

    
58
    /**
59
     * Returns a list of functions to add to the existing list.
60
     *
61
     * @return Twig_SimpleFunction[]
62
     */
63
    public function getFunctions();
64

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

    
72
    /**
73
     * Returns a list of global variables to add to the existing list.
74
     *
75
     * @return array An array of global variables
76
     *
77
     * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_GlobalsInterface instead
78
     */
79
    public function getGlobals();
80

    
81
    /**
82
     * Returns the name of the extension.
83
     *
84
     * @return string The extension name
85
     */
86
    public function getName();
87
}
(11-11/43)