1 | <?php |
||
17 | trait TwitalLoaderTrait |
||
18 | { |
||
19 | /** |
||
20 | * Array of patterns used to decide if a template is twital-compilable or not. |
||
21 | * Items are strings or callbacks |
||
22 | * |
||
23 | * @var array |
||
24 | */ |
||
25 | protected $sourceAdapters = array(); |
||
26 | |||
27 | /** |
||
28 | * The internal Twital compiler |
||
29 | * |
||
30 | * @var Twital |
||
31 | */ |
||
32 | protected $twital; |
||
33 | |||
34 | /** |
||
35 | * The wrapped Twig loader |
||
36 | * |
||
37 | * @var LoaderInterface|\Twig_LoaderInterface |
||
38 | */ |
||
39 | protected $loader; |
||
40 | |||
41 | private $twigMajorVersion; |
||
42 | |||
43 | /** |
||
44 | * Add a new pattern that can decide if a template is twital-compilable or not. |
||
45 | * If $pattern is a string, then must be a valid regex that matches the template filename. |
||
46 | * If $pattern is a callback, then must return true if the template is compilable, false otherwise. |
||
47 | * |
||
48 | * @param string|callback $pattern |
||
49 | * @param SourceAdapter $adapter |
||
50 | * @return TwitalLoader |
||
51 | */ |
||
52 | public function addSourceAdapter($pattern, SourceAdapter $adapter) |
||
58 | |||
59 | /** |
||
60 | * Get all patterns used to choose if a template is twital-compilable or not |
||
61 | * |
||
62 | * @return array: |
||
63 | */ |
||
64 | public function getSourceAdapters() |
||
68 | |||
69 | /** |
||
70 | * Decide if a template is twital-compilable or not. |
||
71 | * |
||
72 | * @param string $name |
||
73 | * @return SourceAdapter |
||
74 | */ |
||
75 | public function getSourceAdapter($name) |
||
85 | |||
86 | /** |
||
87 | * Get the wrapped Twig loader |
||
88 | * |
||
89 | * @return LoaderInterface|\Twig_LoaderInterface |
||
90 | */ |
||
91 | public function getLoader() |
||
95 | |||
96 | /** |
||
97 | * Set the wrapped Twig loader |
||
98 | * |
||
99 | * @param LoaderInterface|\Twig_LoaderInterface $loader |
||
100 | * @return TwitalLoader |
||
101 | */ |
||
102 | public function setLoader($loader) |
||
108 | |||
109 | /** |
||
110 | * @return Twital |
||
111 | */ |
||
112 | public function getTwital() |
||
120 | |||
121 | /** |
||
122 | * Creates a new Twital loader. |
||
123 | * |
||
124 | * @param LoaderInterface|\Twig_LoaderInterface $loader |
||
125 | * @param Twital $twital |
||
126 | * @param bool $addDefaults If NULL, some standard rules will be used (`*.twital.*` and `*.twital`). |
||
127 | */ |
||
128 | private function doConstruct($loader = null, Twital $twital = null, $addDefaults = true) |
||
143 | |||
144 | private function doGetSourceContext($name) |
||
161 | |||
162 | private function doExists($name) |
||
178 | |||
179 | private function getTwigMajorVersion() |
||
187 | } |
||
188 |
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.