1 | <?php |
||
18 | trait TwitalLoaderTrait |
||
19 | { |
||
20 | /** |
||
21 | * Array of patterns used to decide if a template is twital-compilable or not. |
||
22 | * Items are strings or callbacks |
||
23 | * |
||
24 | * @var array |
||
25 | */ |
||
26 | protected $sourceAdapters = array(); |
||
27 | |||
28 | /** |
||
29 | * The internal Twital compiler |
||
30 | * |
||
31 | * @var Twital |
||
32 | */ |
||
33 | protected $twital; |
||
34 | |||
35 | /** |
||
36 | * The wrapped Twig loader |
||
37 | * |
||
38 | * @var LoaderInterface|\Twig_LoaderInterface |
||
39 | */ |
||
40 | protected $loader; |
||
41 | |||
42 | private $twigMajorVersion; |
||
43 | |||
44 | /** |
||
45 | * Add a new pattern that can decide if a template is twital-compilable or not. |
||
46 | * If $pattern is a string, then must be a valid regex that matches the template filename. |
||
47 | * If $pattern is a callback, then must return true if the template is compilable, false otherwise. |
||
48 | * |
||
49 | * @param string|callback $pattern |
||
50 | * @param SourceAdapter $adapter |
||
51 | * @return TwitalLoader |
||
52 | */ |
||
53 | public function addSourceAdapter($pattern, SourceAdapter $adapter) |
||
59 | |||
60 | /** |
||
61 | * Get all patterns used to choose if a template is twital-compilable or not |
||
62 | * |
||
63 | * @return array: |
||
64 | */ |
||
65 | public function getSourceAdapters() |
||
69 | |||
70 | /** |
||
71 | * Decide if a template is twital-compilable or not. |
||
72 | * |
||
73 | * @param string $name |
||
74 | * @return SourceAdapter |
||
75 | */ |
||
76 | public function getSourceAdapter($name) |
||
86 | |||
87 | /** |
||
88 | * Get the wrapped Twig loader |
||
89 | * |
||
90 | * @return LoaderInterface|\Twig_LoaderInterface |
||
91 | */ |
||
92 | public function getLoader() |
||
96 | |||
97 | /** |
||
98 | * Set the wrapped Twig loader |
||
99 | * |
||
100 | * @param LoaderInterface|\Twig_LoaderInterface $loader |
||
101 | * @return TwitalLoader |
||
102 | */ |
||
103 | public function setLoader($loader) |
||
109 | |||
110 | /** |
||
111 | * @return Twital |
||
112 | */ |
||
113 | public function getTwital() |
||
121 | |||
122 | /** |
||
123 | * Creates a new Twital loader. |
||
124 | * |
||
125 | * @param LoaderInterface|\Twig_LoaderInterface $loader |
||
126 | * @param Twital $twital |
||
127 | * @param bool $addDefaults If NULL, some standard rules will be used (`*.twital.*` and `*.twital`). |
||
128 | */ |
||
129 | private function doConstruct($loader = null, Twital $twital = null, $addDefaults = true) |
||
144 | |||
145 | private function doGetSourceContext($name) |
||
162 | |||
163 | private function doExists($name) |
||
179 | |||
180 | private function getTwigMajorVersion() |
||
188 | } |
||
189 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.