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 | /** |
||
43 | * Creates a new Twital loader. |
||
44 | * |
||
45 | * @param LoaderInterface $loader |
||
46 | * @param Twital $twital |
||
47 | * @param bool $addDefaults If NULL, some standard rules will be used (`*.twital.*` and `*.twital`). |
||
48 | */ |
||
49 | public function __construct(LoaderInterface $loader = null, Twital $twital = null, $addDefaults = true) |
||
64 | |||
65 | /** |
||
66 | * Add a new pattern that can decide if a template is twital-compilable or not. |
||
67 | * If $pattern is a string, then must be a valid regex that matches the template filename. |
||
68 | * If $pattern is a callback, then must return true if the template is compilable, false otherwise. |
||
69 | * |
||
70 | * @param string|callback $pattern |
||
71 | * @param SourceAdapter $adapter |
||
72 | * @return TwitalLoader |
||
73 | */ |
||
74 | public function addSourceAdapter($pattern, SourceAdapter $adapter) |
||
80 | |||
81 | /** |
||
82 | * Get all patterns used to choose if a template is twital-compilable or not |
||
83 | * |
||
84 | * @return array: |
||
85 | */ |
||
86 | public function getSourceAdapters() |
||
90 | |||
91 | /** |
||
92 | * Decide if a template is twital-compilable or not. |
||
93 | * |
||
94 | * @param string $name |
||
95 | * @return SourceAdapter |
||
96 | */ |
||
97 | public function getSourceAdapter($name) |
||
107 | |||
108 | /** |
||
109 | * Get the wrapped Twig loader |
||
110 | * |
||
111 | * @return LoaderInterface|\Twig_LoaderInterface |
||
112 | */ |
||
113 | public function getLoader() |
||
117 | |||
118 | /** |
||
119 | * Set the wrapped Twig loader |
||
120 | * |
||
121 | * @param LoaderInterface|\Twig_LoaderInterface $loader |
||
122 | * @return TwitalLoader |
||
123 | */ |
||
124 | public function setLoader($loader) |
||
130 | |||
131 | /** |
||
132 | * @return Twital |
||
133 | */ |
||
134 | public function getTwital() |
||
142 | |||
143 | private function doGetSourceContext($name) |
||
160 | |||
161 | private function doExists($name) |
||
175 | } |
||
176 |
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.