@@ -38,6 +38,5 @@ |
||
38 | 38 | * Class TemplateException |
39 | 39 | * @package Platine\Template\Exception |
40 | 40 | */ |
41 | -class TemplateException extends Exception |
|
42 | -{ |
|
41 | +class TemplateException extends Exception { |
|
43 | 42 | } |
@@ -97,8 +97,8 @@ |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
100 | - * {@inheritdoc} |
|
101 | - */ |
|
100 | + * {@inheritdoc} |
|
101 | + */ |
|
102 | 102 | public function read(string $name): string |
103 | 103 | { |
104 | 104 | $file = $this->getFilePath($name); |
@@ -59,8 +59,7 @@ discard block |
||
59 | 59 | * Class FileLoader |
60 | 60 | * @package Platine\Template\Loader |
61 | 61 | */ |
62 | -class FileLoader implements LoaderInterface |
|
63 | -{ |
|
62 | +class FileLoader implements LoaderInterface { |
|
64 | 63 | /** |
65 | 64 | * The configuration instance |
66 | 65 | * @var Configuration |
@@ -77,8 +76,7 @@ discard block |
||
77 | 76 | * Create new instance |
78 | 77 | * @param Configuration|null $config |
79 | 78 | */ |
80 | - public function __construct(?Configuration $config = null) |
|
81 | - { |
|
79 | + public function __construct(?Configuration $config = null) { |
|
82 | 80 | $this->config = $config ?? new Configuration([]); |
83 | 81 | |
84 | 82 | $dir = $this->config->get('template_dir'); |
@@ -75,7 +75,7 @@ |
||
75 | 75 | |
76 | 76 | /** |
77 | 77 | * {@inheritdoc} |
78 | - */ |
|
78 | + */ |
|
79 | 79 | public function read(string $name): string |
80 | 80 | { |
81 | 81 | if (!array_key_exists($name, $this->data)) { |
@@ -55,8 +55,7 @@ discard block |
||
55 | 55 | * Class StringLoader |
56 | 56 | * @package Platine\Template\Loader |
57 | 57 | */ |
58 | -class StringLoader implements LoaderInterface |
|
59 | -{ |
|
58 | +class StringLoader implements LoaderInterface { |
|
60 | 59 | /** |
61 | 60 | * The string hash data |
62 | 61 | * @var array<string, string> |
@@ -67,8 +66,7 @@ discard block |
||
67 | 66 | * Create new instance |
68 | 67 | * @param array<string, string> $data |
69 | 68 | */ |
70 | - public function __construct(array $data) |
|
71 | - { |
|
69 | + public function __construct(array $data) { |
|
72 | 70 | $this->data = $data; |
73 | 71 | } |
74 | 72 |
@@ -41,6 +41,5 @@ |
||
41 | 41 | * Class LoaderException |
42 | 42 | * @package Platine\Template\Exception |
43 | 43 | */ |
44 | -class LoaderException extends TemplateException |
|
45 | -{ |
|
44 | +class LoaderException extends TemplateException { |
|
46 | 45 | } |
@@ -39,6 +39,5 @@ |
||
39 | 39 | * Class RenderException |
40 | 40 | * @package Platine\Template\Exception |
41 | 41 | */ |
42 | -class RenderException extends TemplateException |
|
43 | -{ |
|
42 | +class RenderException extends TemplateException { |
|
44 | 43 | } |
@@ -39,6 +39,5 @@ |
||
39 | 39 | * Class NotFoundException |
40 | 40 | * @package Platine\Template\Exception |
41 | 41 | */ |
42 | -class NotFoundException extends LoaderException |
|
43 | -{ |
|
42 | +class NotFoundException extends LoaderException { |
|
44 | 43 | } |
@@ -39,6 +39,5 @@ |
||
39 | 39 | * Class ParseException |
40 | 40 | * @package Platine\Template\Exception |
41 | 41 | */ |
42 | -class ParseException extends TemplateException |
|
43 | -{ |
|
42 | +class ParseException extends TemplateException { |
|
44 | 43 | } |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
117 | - * {@inheritdoc} |
|
118 | - */ |
|
117 | + * {@inheritdoc} |
|
118 | + */ |
|
119 | 119 | protected function blockDelimiter(): string |
120 | 120 | { |
121 | 121 | //There isn't a real delimiter |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
126 | - * {@inheritdoc} |
|
127 | - */ |
|
126 | + * {@inheritdoc} |
|
127 | + */ |
|
128 | 128 | protected function assertMissingDelimiter(): void |
129 | 129 | { |
130 | 130 | // Document blocks don't need to be |
@@ -57,16 +57,14 @@ |
||
57 | 57 | * Class Document |
58 | 58 | * @package Platine\Template\Parser |
59 | 59 | */ |
60 | -class Document extends AbstractBlock |
|
61 | -{ |
|
60 | +class Document extends AbstractBlock { |
|
62 | 61 | |
63 | 62 | /** |
64 | 63 | * Create new instance |
65 | 64 | * @param array<int, string> $tokens |
66 | 65 | * @param Parser $parser |
67 | 66 | */ |
68 | - public function __construct(array &$tokens, Parser $parser) |
|
69 | - { |
|
67 | + public function __construct(array &$tokens, Parser $parser) { |
|
70 | 68 | $this->parser = $parser; |
71 | 69 | |
72 | 70 | $this->parse($tokens); |
@@ -58,8 +58,7 @@ discard block |
||
58 | 58 | * Class Context |
59 | 59 | * @package Platine\Template\Parser |
60 | 60 | */ |
61 | -class Context |
|
62 | -{ |
|
61 | +class Context { |
|
63 | 62 | /** |
64 | 63 | * The local scopes |
65 | 64 | * @var array<int, array<string, mixed>> |
@@ -103,8 +102,7 @@ discard block |
||
103 | 102 | * @param array<string, mixed> $assigns |
104 | 103 | * @param array<string, mixed> $registers |
105 | 104 | */ |
106 | - public function __construct(array $assigns = [], array $registers = []) |
|
107 | - { |
|
105 | + public function __construct(array $assigns = [], array $registers = []) { |
|
108 | 106 | $this->assigns = [$assigns]; |
109 | 107 | $this->registers = $registers; |
110 | 108 | $this->filters = new FilterCollection(); |
@@ -128,8 +126,7 @@ discard block |
||
128 | 126 | * @param callable|null $tickCallback |
129 | 127 | * @return $this |
130 | 128 | */ |
131 | - public function setTickCallback(?callable $tickCallback) |
|
132 | - { |
|
129 | + public function setTickCallback(?callable $tickCallback) { |
|
133 | 130 | $this->tickCallback = $tickCallback; |
134 | 131 | |
135 | 132 | return $this; |
@@ -154,8 +151,7 @@ discard block |
||
154 | 151 | * @param array<int, mixed> $args |
155 | 152 | * @return mixed |
156 | 153 | */ |
157 | - public function invokeFilter(string $name, $value, array $args = []) |
|
158 | - { |
|
154 | + public function invokeFilter(string $name, $value, array $args = []) { |
|
159 | 155 | try { |
160 | 156 | return $this->filters->invoke($name, $value, $args); |
161 | 157 | } catch (TypeError $ex) { |
@@ -199,8 +195,7 @@ discard block |
||
199 | 195 | * @param string $key |
200 | 196 | * @return mixed |
201 | 197 | */ |
202 | - public function get(string $key) |
|
203 | - { |
|
198 | + public function get(string $key) { |
|
204 | 199 | return $this->resolve($key); |
205 | 200 | } |
206 | 201 | |
@@ -260,8 +255,7 @@ discard block |
||
260 | 255 | * @param string $name |
261 | 256 | * @return mixed|null |
262 | 257 | */ |
263 | - public function getRegister(string $name) |
|
264 | - { |
|
258 | + public function getRegister(string $name) { |
|
265 | 259 | if ($this->hasRegister($name)) { |
266 | 260 | return $this->registers[$name]; |
267 | 261 | } |
@@ -297,8 +291,7 @@ discard block |
||
297 | 291 | * @param string $name |
298 | 292 | * @return mixed|null |
299 | 293 | */ |
300 | - public function getEnvironment(string $name) |
|
301 | - { |
|
294 | + public function getEnvironment(string $name) { |
|
302 | 295 | if ($this->hasEnvironment($name)) { |
303 | 296 | return $this->environments[$name]; |
304 | 297 | } |
@@ -338,8 +331,7 @@ discard block |
||
338 | 331 | * @param string $key |
339 | 332 | * @return mixed|null |
340 | 333 | */ |
341 | - protected function resolve(string $key) |
|
342 | - { |
|
334 | + protected function resolve(string $key) { |
|
343 | 335 | if ($key === 'null') { |
344 | 336 | return null; |
345 | 337 | } |
@@ -377,8 +369,7 @@ discard block |
||
377 | 369 | * @param string $key |
378 | 370 | * @return mixed|null |
379 | 371 | */ |
380 | - protected function fetch(string $key) |
|
381 | - { |
|
372 | + protected function fetch(string $key) { |
|
382 | 373 | if (array_key_exists($key, $this->environments)) { |
383 | 374 | return $this->environments[$key]; |
384 | 375 | } |
@@ -403,8 +394,7 @@ discard block |
||
403 | 394 | * @param string $key |
404 | 395 | * @return mixed|null |
405 | 396 | */ |
406 | - protected function variable(string $key) |
|
407 | - { |
|
397 | + protected function variable(string $key) { |
|
408 | 398 | // Support numeric and variable array indicies |
409 | 399 | $matches = []; |
410 | 400 | if (preg_match('|\[[0-9]+\]|', $key)) { |