1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,282 +0,0 @@ |
1 |
-<?php declare(strict_types=1); |
|
2 |
-/** |
|
3 |
- * Part of Windwalker project. |
|
4 |
- * |
|
5 |
- * @copyright Copyright (C) 2019 LYRASOFT. |
|
6 |
- * @license GNU General Public License version 2 or later; |
|
7 |
- */ |
|
8 |
- |
|
9 |
-namespace Windwalker\Renderer\Blade; |
|
10 |
- |
|
11 |
-/** |
|
12 |
- * The GlobalContainer class. |
|
13 |
- * |
|
14 |
- * @since 2.1.1 |
|
15 |
- */ |
|
16 |
-abstract class GlobalContainer |
|
17 |
-{ |
|
18 |
- /** |
|
19 |
- * Property compilers. |
|
20 |
- * |
|
21 |
- * @var callable[] |
|
22 |
- */ |
|
23 |
- protected static $compilers = []; |
|
24 |
- |
|
25 |
- /** |
|
26 |
- * Property extensions. |
|
27 |
- * |
|
28 |
- * @var array |
|
29 |
- */ |
|
30 |
- protected static $extensions = []; |
|
31 |
- |
|
32 |
- /** |
|
33 |
- * Property cachePath. |
|
34 |
- * |
|
35 |
- * @var string |
|
36 |
- */ |
|
37 |
- protected static $cachePath; |
|
38 |
- |
|
39 |
- /** |
|
40 |
- * Array of opening and closing tags for raw echos. |
|
41 |
- * |
|
42 |
- * @var array |
|
43 |
- */ |
|
44 |
- protected static $rawTags = []; |
|
45 |
- |
|
46 |
- /** |
|
47 |
- * Array of opening and closing tags for regular echos. |
|
48 |
- * |
|
49 |
- * @var array |
|
50 |
- */ |
|
51 |
- protected static $contentTags = []; |
|
52 |
- |
|
53 |
- /** |
|
54 |
- * Array of opening and closing tags for escaped echos. |
|
55 |
- * |
|
56 |
- * @var array |
|
57 |
- */ |
|
58 |
- protected static $escapedTags = []; |
|
59 |
- |
|
60 |
- /** |
|
61 |
- * addCompiler |
|
62 |
- * |
|
63 |
- * @param string $name |
|
64 |
- * @param callable $compiler |
|
65 |
- * |
|
66 |
- * @return void |
|
67 |
- */ |
|
68 |
- public static function addCompiler($name, $compiler) |
|
69 |
- { |
|
70 |
- if (!is_callable($compiler)) { |
|
71 |
- throw new \InvalidArgumentException('Compiler should be callable.'); |
|
72 |
- } |
|
73 |
- |
|
74 |
- static::$compilers[$name] = $compiler; |
|
75 |
- } |
|
76 |
- |
|
77 |
- /** |
|
78 |
- * getCompiler |
|
79 |
- * |
|
80 |
- * @param string $name |
|
81 |
- * |
|
82 |
- * @return callable |
|
83 |
- */ |
|
84 |
- public static function getCompiler($name) |
|
85 |
- { |
|
86 |
- if (!empty(static::$compilers[$name])) { |
|
87 |
- return static::$compilers[$name]; |
|
88 |
- } |
|
89 |
- |
|
90 |
- return null; |
|
91 |
- } |
|
92 |
- |
|
93 |
- /** |
|
94 |
- * removeCompiler |
|
95 |
- * |
|
96 |
- * @param string $name |
|
97 |
- * |
|
98 |
- * @return void |
|
99 |
- */ |
|
100 |
- public static function removeCompiler($name) |
|
101 |
- { |
|
102 |
- if (isset(static::$compilers[$name])) { |
|
103 |
- unset(static::$compilers[$name]); |
|
104 |
- } |
|
105 |
- } |
|
106 |
- |
|
107 |
- /** |
|
108 |
- * Method to get property Compilers |
|
109 |
- * |
|
110 |
- * @return callable[] |
|
111 |
- */ |
|
112 |
- public static function getCompilers() |
|
113 |
- { |
|
114 |
- return static::$compilers; |
|
115 |
- } |
|
116 |
- |
|
117 |
- /** |
|
118 |
- * Method to set property extensions |
|
119 |
- * |
|
120 |
- * @param callable[] $compilers |
|
121 |
- * |
|
122 |
- * @return void |
|
123 |
- */ |
|
124 |
- public static function setCompilers(array $compilers) |
|
125 |
- { |
|
126 |
- static::$compilers = $compilers; |
|
127 |
- } |
|
128 |
- |
|
129 |
- /** |
|
130 |
- * addExtension |
|
131 |
- * |
|
132 |
- * @param string $name |
|
133 |
- * @param callable $extension |
|
134 |
- * |
|
135 |
- * @return void |
|
136 |
- */ |
|
137 |
- public static function addExtension($name, $extension) |
|
138 |
- { |
|
139 |
- if (!is_callable($extension)) { |
|
140 |
- throw new \InvalidArgumentException('Extension should be callable.'); |
|
141 |
- } |
|
142 |
- |
|
143 |
- static::$extensions[$name] = $extension; |
|
144 |
- } |
|
145 |
- |
|
146 |
- /** |
|
147 |
- * getExtension |
|
148 |
- * |
|
149 |
- * @param string $name |
|
150 |
- * |
|
151 |
- * @return callable |
|
152 |
- */ |
|
153 |
- public static function getExtension($name) |
|
154 |
- { |
|
155 |
- if (!empty(static::$extensions[$name])) { |
|
156 |
- return static::$extensions[$name]; |
|
157 |
- } |
|
158 |
- |
|
159 |
- return null; |
|
160 |
- } |
|
161 |
- |
|
162 |
- /** |
|
163 |
- * removeExtension |
|
164 |
- * |
|
165 |
- * @param string $name |
|
166 |
- * |
|
167 |
- * @return void |
|
168 |
- */ |
|
169 |
- public static function removeExtension($name) |
|
170 |
- { |
|
171 |
- if (isset(static::$extensions[$name])) { |
|
172 |
- unset(static::$extensions[$name]); |
|
173 |
- } |
|
174 |
- } |
|
175 |
- |
|
176 |
- /** |
|
177 |
- * Method to get property Extensions |
|
178 |
- * |
|
179 |
- * @return array |
|
180 |
- */ |
|
181 |
- public static function getExtensions() |
|
182 |
- { |
|
183 |
- return static::$extensions; |
|
184 |
- } |
|
185 |
- |
|
186 |
- /** |
|
187 |
- * Method to set property extensions |
|
188 |
- * |
|
189 |
- * @param array $extensions |
|
190 |
- * |
|
191 |
- * @return void |
|
192 |
- */ |
|
193 |
- public static function setExtensions($extensions) |
|
194 |
- { |
|
195 |
- static::$extensions = $extensions; |
|
196 |
- } |
|
197 |
- |
|
198 |
- /** |
|
199 |
- * Method to get property CachePath |
|
200 |
- * |
|
201 |
- * @return string |
|
202 |
- */ |
|
203 |
- public static function getCachePath() |
|
204 |
- { |
|
205 |
- return static::$cachePath; |
|
206 |
- } |
|
207 |
- |
|
208 |
- /** |
|
209 |
- * Method to set property cachePath |
|
210 |
- * |
|
211 |
- * @param string $cachePath |
|
212 |
- * |
|
213 |
- * @return void |
|
214 |
- */ |
|
215 |
- public static function setCachePath($cachePath) |
|
216 |
- { |
|
217 |
- static::$cachePath = $cachePath; |
|
218 |
- } |
|
219 |
- |
|
220 |
- /** |
|
221 |
- * Method to get property RawTags |
|
222 |
- * |
|
223 |
- * @return array |
|
224 |
- */ |
|
225 |
- public static function getRawTags() |
|
226 |
- { |
|
227 |
- return static::$rawTags; |
|
228 |
- } |
|
229 |
- |
|
230 |
- /** |
|
231 |
- * Method to set property rawTags |
|
232 |
- * |
|
233 |
- * @param string $start |
|
234 |
- * @param string $end |
|
235 |
- */ |
|
236 |
- public static function setRawTags($start, $end) |
|
237 |
- { |
|
238 |
- static::$rawTags = [$start, $end]; |
|
239 |
- } |
|
240 |
- |
|
241 |
- /** |
|
242 |
- * Method to get property ContentTags |
|
243 |
- * |
|
244 |
- * @return array |
|
245 |
- */ |
|
246 |
- public static function getContentTags() |
|
247 |
- { |
|
248 |
- return static::$contentTags; |
|
249 |
- } |
|
250 |
- |
|
251 |
- /** |
|
252 |
- * Method to set property contentTags |
|
253 |
- * |
|
254 |
- * @param string $start |
|
255 |
- * @param string $end |
|
256 |
- */ |
|
257 |
- public static function setContentTags($start, $end) |
|
258 |
- { |
|
259 |
- static::$contentTags = [$start, $end]; |
|
260 |
- } |
|
261 |
- |
|
262 |
- /** |
|
263 |
- * Method to get property EscapedTags |
|
264 |
- * |
|
265 |
- * @return array |
|
266 |
- */ |
|
267 |
- public static function getEscapedTags() |
|
268 |
- { |
|
269 |
- return static::$escapedTags; |
|
270 |
- } |
|
271 |
- |
|
272 |
- /** |
|
273 |
- * Method to set property escapedTags |
|
274 |
- * |
|
275 |
- * @param string $start |
|
276 |
- * @param string $end |
|
277 |
- */ |
|
278 |
- public static function setEscapedTags($start, $end) |
|
279 |
- { |
|
280 |
- static::$escapedTags = [$start, $end]; |
|
281 |
- } |
|
282 |
-} |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,282 @@ |
1 |
+<?php declare(strict_types=1); |
|
2 |
+/** |
|
3 |
+ * Part of Windwalker project. |
|
4 |
+ * |
|
5 |
+ * @copyright Copyright (C) 2019 LYRASOFT. |
|
6 |
+ * @license GNU General Public License version 2 or later; |
|
7 |
+ */ |
|
8 |
+ |
|
9 |
+namespace Windwalker\Renderer\Blade; |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * The GlobalContainer class. |
|
13 |
+ * |
|
14 |
+ * @since 2.1.1 |
|
15 |
+ */ |
|
16 |
+abstract class GlobalContainer |
|
17 |
+{ |
|
18 |
+ /** |
|
19 |
+ * Property compilers. |
|
20 |
+ * |
|
21 |
+ * @var callable[] |
|
22 |
+ */ |
|
23 |
+ protected static $compilers = []; |
|
24 |
+ |
|
25 |
+ /** |
|
26 |
+ * Property extensions. |
|
27 |
+ * |
|
28 |
+ * @var array |
|
29 |
+ */ |
|
30 |
+ protected static $extensions = []; |
|
31 |
+ |
|
32 |
+ /** |
|
33 |
+ * Property cachePath. |
|
34 |
+ * |
|
35 |
+ * @var string |
|
36 |
+ */ |
|
37 |
+ protected static $cachePath; |
|
38 |
+ |
|
39 |
+ /** |
|
40 |
+ * Array of opening and closing tags for raw echos. |
|
41 |
+ * |
|
42 |
+ * @var array |
|
43 |
+ */ |
|
44 |
+ protected static $rawTags = []; |
|
45 |
+ |
|
46 |
+ /** |
|
47 |
+ * Array of opening and closing tags for regular echos. |
|
48 |
+ * |
|
49 |
+ * @var array |
|
50 |
+ */ |
|
51 |
+ protected static $contentTags = []; |
|
52 |
+ |
|
53 |
+ /** |
|
54 |
+ * Array of opening and closing tags for escaped echos. |
|
55 |
+ * |
|
56 |
+ * @var array |
|
57 |
+ */ |
|
58 |
+ protected static $escapedTags = []; |
|
59 |
+ |
|
60 |
+ /** |
|
61 |
+ * addCompiler |
|
62 |
+ * |
|
63 |
+ * @param string $name |
|
64 |
+ * @param callable $compiler |
|
65 |
+ * |
|
66 |
+ * @return void |
|
67 |
+ */ |
|
68 |
+ public static function addCompiler($name, $compiler) |
|
69 |
+ { |
|
70 |
+ if (!is_callable($compiler)) { |
|
71 |
+ throw new \InvalidArgumentException('Compiler should be callable.'); |
|
72 |
+ } |
|
73 |
+ |
|
74 |
+ static::$compilers[$name] = $compiler; |
|
75 |
+ } |
|
76 |
+ |
|
77 |
+ /** |
|
78 |
+ * getCompiler |
|
79 |
+ * |
|
80 |
+ * @param string $name |
|
81 |
+ * |
|
82 |
+ * @return callable |
|
83 |
+ */ |
|
84 |
+ public static function getCompiler($name) |
|
85 |
+ { |
|
86 |
+ if (!empty(static::$compilers[$name])) { |
|
87 |
+ return static::$compilers[$name]; |
|
88 |
+ } |
|
89 |
+ |
|
90 |
+ return null; |
|
91 |
+ } |
|
92 |
+ |
|
93 |
+ /** |
|
94 |
+ * removeCompiler |
|
95 |
+ * |
|
96 |
+ * @param string $name |
|
97 |
+ * |
|
98 |
+ * @return void |
|
99 |
+ */ |
|
100 |
+ public static function removeCompiler($name) |
|
101 |
+ { |
|
102 |
+ if (isset(static::$compilers[$name])) { |
|
103 |
+ unset(static::$compilers[$name]); |
|
104 |
+ } |
|
105 |
+ } |
|
106 |
+ |
|
107 |
+ /** |
|
108 |
+ * Method to get property Compilers |
|
109 |
+ * |
|
110 |
+ * @return callable[] |
|
111 |
+ */ |
|
112 |
+ public static function getCompilers() |
|
113 |
+ { |
|
114 |
+ return static::$compilers; |
|
115 |
+ } |
|
116 |
+ |
|
117 |
+ /** |
|
118 |
+ * Method to set property extensions |
|
119 |
+ * |
|
120 |
+ * @param callable[] $compilers |
|
121 |
+ * |
|
122 |
+ * @return void |
|
123 |
+ */ |
|
124 |
+ public static function setCompilers(array $compilers) |
|
125 |
+ { |
|
126 |
+ static::$compilers = $compilers; |
|
127 |
+ } |
|
128 |
+ |
|
129 |
+ /** |
|
130 |
+ * addExtension |
|
131 |
+ * |
|
132 |
+ * @param string $name |
|
133 |
+ * @param callable $extension |
|
134 |
+ * |
|
135 |
+ * @return void |
|
136 |
+ */ |
|
137 |
+ public static function addExtension($name, $extension) |
|
138 |
+ { |
|
139 |
+ if (!is_callable($extension)) { |
|
140 |
+ throw new \InvalidArgumentException('Extension should be callable.'); |
|
141 |
+ } |
|
142 |
+ |
|
143 |
+ static::$extensions[$name] = $extension; |
|
144 |
+ } |
|
145 |
+ |
|
146 |
+ /** |
|
147 |
+ * getExtension |
|
148 |
+ * |
|
149 |
+ * @param string $name |
|
150 |
+ * |
|
151 |
+ * @return callable |
|
152 |
+ */ |
|
153 |
+ public static function getExtension($name) |
|
154 |
+ { |
|
155 |
+ if (!empty(static::$extensions[$name])) { |
|
156 |
+ return static::$extensions[$name]; |
|
157 |
+ } |
|
158 |
+ |
|
159 |
+ return null; |
|
160 |
+ } |
|
161 |
+ |
|
162 |
+ /** |
|
163 |
+ * removeExtension |
|
164 |
+ * |
|
165 |
+ * @param string $name |
|
166 |
+ * |
|
167 |
+ * @return void |
|
168 |
+ */ |
|
169 |
+ public static function removeExtension($name) |
|
170 |
+ { |
|
171 |
+ if (isset(static::$extensions[$name])) { |
|
172 |
+ unset(static::$extensions[$name]); |
|
173 |
+ } |
|
174 |
+ } |
|
175 |
+ |
|
176 |
+ /** |
|
177 |
+ * Method to get property Extensions |
|
178 |
+ * |
|
179 |
+ * @return array |
|
180 |
+ */ |
|
181 |
+ public static function getExtensions() |
|
182 |
+ { |
|
183 |
+ return static::$extensions; |
|
184 |
+ } |
|
185 |
+ |
|
186 |
+ /** |
|
187 |
+ * Method to set property extensions |
|
188 |
+ * |
|
189 |
+ * @param array $extensions |
|
190 |
+ * |
|
191 |
+ * @return void |
|
192 |
+ */ |
|
193 |
+ public static function setExtensions($extensions) |
|
194 |
+ { |
|
195 |
+ static::$extensions = $extensions; |
|
196 |
+ } |
|
197 |
+ |
|
198 |
+ /** |
|
199 |
+ * Method to get property CachePath |
|
200 |
+ * |
|
201 |
+ * @return string |
|
202 |
+ */ |
|
203 |
+ public static function getCachePath() |
|
204 |
+ { |
|
205 |
+ return static::$cachePath; |
|
206 |
+ } |
|
207 |
+ |
|
208 |
+ /** |
|
209 |
+ * Method to set property cachePath |
|
210 |
+ * |
|
211 |
+ * @param string $cachePath |
|
212 |
+ * |
|
213 |
+ * @return void |
|
214 |
+ */ |
|
215 |
+ public static function setCachePath($cachePath) |
|
216 |
+ { |
|
217 |
+ static::$cachePath = $cachePath; |
|
218 |
+ } |
|
219 |
+ |
|
220 |
+ /** |
|
221 |
+ * Method to get property RawTags |
|
222 |
+ * |
|
223 |
+ * @return array |
|
224 |
+ */ |
|
225 |
+ public static function getRawTags() |
|
226 |
+ { |
|
227 |
+ return static::$rawTags; |
|
228 |
+ } |
|
229 |
+ |
|
230 |
+ /** |
|
231 |
+ * Method to set property rawTags |
|
232 |
+ * |
|
233 |
+ * @param string $start |
|
234 |
+ * @param string $end |
|
235 |
+ */ |
|
236 |
+ public static function setRawTags($start, $end) |
|
237 |
+ { |
|
238 |
+ static::$rawTags = [$start, $end]; |
|
239 |
+ } |
|
240 |
+ |
|
241 |
+ /** |
|
242 |
+ * Method to get property ContentTags |
|
243 |
+ * |
|
244 |
+ * @return array |
|
245 |
+ */ |
|
246 |
+ public static function getContentTags() |
|
247 |
+ { |
|
248 |
+ return static::$contentTags; |
|
249 |
+ } |
|
250 |
+ |
|
251 |
+ /** |
|
252 |
+ * Method to set property contentTags |
|
253 |
+ * |
|
254 |
+ * @param string $start |
|
255 |
+ * @param string $end |
|
256 |
+ */ |
|
257 |
+ public static function setContentTags($start, $end) |
|
258 |
+ { |
|
259 |
+ static::$contentTags = [$start, $end]; |
|
260 |
+ } |
|
261 |
+ |
|
262 |
+ /** |
|
263 |
+ * Method to get property EscapedTags |
|
264 |
+ * |
|
265 |
+ * @return array |
|
266 |
+ */ |
|
267 |
+ public static function getEscapedTags() |
|
268 |
+ { |
|
269 |
+ return static::$escapedTags; |
|
270 |
+ } |
|
271 |
+ |
|
272 |
+ /** |
|
273 |
+ * Method to set property escapedTags |
|
274 |
+ * |
|
275 |
+ * @param string $start |
|
276 |
+ * @param string $end |
|
277 |
+ */ |
|
278 |
+ public static function setEscapedTags($start, $end) |
|
279 |
+ { |
|
280 |
+ static::$escapedTags = [$start, $end]; |
|
281 |
+ } |
|
282 |
+} |