@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | protected array $data = []; |
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | - * {@inheritdoc} |
|
| 66 | - */ |
|
| 65 | + * {@inheritdoc} |
|
| 66 | + */ |
|
| 67 | 67 | public function read(string $key, bool $unserialize = false) |
| 68 | 68 | { |
| 69 | 69 | if (!$this->exists($key)) { |
@@ -74,16 +74,16 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | - * {@inheritdoc} |
|
| 78 | - */ |
|
| 77 | + * {@inheritdoc} |
|
| 78 | + */ |
|
| 79 | 79 | public function exists(string $key): bool |
| 80 | 80 | { |
| 81 | 81 | return isset($this->data[$key]); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | - * {@inheritdoc} |
|
| 86 | - */ |
|
| 85 | + * {@inheritdoc} |
|
| 86 | + */ |
|
| 87 | 87 | public function write(string $key, $value, bool $serialize = false): bool |
| 88 | 88 | { |
| 89 | 89 | $this->data[$key] = $value; |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | - * {@inheritdoc} |
|
| 97 | - */ |
|
| 96 | + * {@inheritdoc} |
|
| 97 | + */ |
|
| 98 | 98 | public function flush(bool $expired = false): bool |
| 99 | 99 | { |
| 100 | 100 | $this->data = []; |
@@ -53,8 +53,7 @@ discard block |
||
| 53 | 53 | * Class MemoryCache |
| 54 | 54 | * @package Platine\Template\Cache |
| 55 | 55 | */ |
| 56 | -class MemoryCache extends AbstractCache |
|
| 57 | -{ |
|
| 56 | +class MemoryCache extends AbstractCache { |
|
| 58 | 57 | /** |
| 59 | 58 | * The cache data |
| 60 | 59 | * @var array<string, mixed> |
@@ -64,8 +63,7 @@ discard block |
||
| 64 | 63 | /** |
| 65 | 64 | * {@inheritdoc} |
| 66 | 65 | */ |
| 67 | - public function read(string $key, bool $unserialize = false) |
|
| 68 | - { |
|
| 66 | + public function read(string $key, bool $unserialize = false) { |
|
| 69 | 67 | if (!$this->exists($key)) { |
| 70 | 68 | return false; |
| 71 | 69 | } |
@@ -387,7 +387,7 @@ |
||
| 387 | 387 | |
| 388 | 388 | return (string) preg_replace_callback( |
| 389 | 389 | '/(^|[^\p{L}\'])([\p{Ll}])/u', |
| 390 | - function ($matches) { |
|
| 390 | + function($matches) { |
|
| 391 | 391 | return $matches[1] . ucfirst($matches[2]); |
| 392 | 392 | }, |
| 393 | 393 | ucwords($variable) |
@@ -56,15 +56,13 @@ discard block |
||
| 56 | 56 | * Class StringFilter |
| 57 | 57 | * @package Platine\Template\Filter |
| 58 | 58 | */ |
| 59 | -class StringFilter extends AbstractFilter |
|
| 60 | -{ |
|
| 59 | +class StringFilter extends AbstractFilter { |
|
| 61 | 60 | /** |
| 62 | 61 | * Return the length of string or array |
| 63 | 62 | * @param mixed $variable |
| 64 | 63 | * @return int|mixed |
| 65 | 64 | */ |
| 66 | - public static function length($variable) |
|
| 67 | - { |
|
| 65 | + public static function length($variable) { |
|
| 68 | 66 | if ($variable instanceof Traversable) { |
| 69 | 67 | return iterator_count($variable); |
| 70 | 68 | } |
@@ -96,8 +94,7 @@ discard block |
||
| 96 | 94 | * @param mixed $value |
| 97 | 95 | * @return string|mixed |
| 98 | 96 | */ |
| 99 | - public static function append($variable, $value) |
|
| 100 | - { |
|
| 97 | + public static function append($variable, $value) { |
|
| 101 | 98 | if (!is_string($variable) || !is_string($value)) { |
| 102 | 99 | return $variable; |
| 103 | 100 | } |
@@ -111,8 +108,7 @@ discard block |
||
| 111 | 108 | * @param mixed $value |
| 112 | 109 | * @return string|mixed |
| 113 | 110 | */ |
| 114 | - public static function prepend($variable, $value) |
|
| 115 | - { |
|
| 111 | + public static function prepend($variable, $value) { |
|
| 116 | 112 | if (!is_string($variable) || !is_string($value)) { |
| 117 | 113 | return $variable; |
| 118 | 114 | } |
@@ -126,8 +122,7 @@ discard block |
||
| 126 | 122 | * @param mixed $value |
| 127 | 123 | * @return string|mixed |
| 128 | 124 | */ |
| 129 | - public static function remove($variable, $value) |
|
| 130 | - { |
|
| 125 | + public static function remove($variable, $value) { |
|
| 131 | 126 | if (!is_string($variable) || !is_string($value)) { |
| 132 | 127 | return $variable; |
| 133 | 128 | } |
@@ -142,8 +137,7 @@ discard block |
||
| 142 | 137 | * @param mixed $replacement |
| 143 | 138 | * @return string|mixed |
| 144 | 139 | */ |
| 145 | - public static function replace($variable, $value, $replacement = '') |
|
| 146 | - { |
|
| 140 | + public static function replace($variable, $value, $replacement = '') { |
|
| 147 | 141 | if (!is_string($variable) || !is_string($value) || !is_string($replacement)) { |
| 148 | 142 | return $variable; |
| 149 | 143 | } |
@@ -158,8 +152,7 @@ discard block |
||
| 158 | 152 | * @param string|mixed $ending |
| 159 | 153 | * @return string|mixed |
| 160 | 154 | */ |
| 161 | - public static function truncate($variable, $count = 100, $ending = '...') |
|
| 162 | - { |
|
| 155 | + public static function truncate($variable, $count = 100, $ending = '...') { |
|
| 163 | 156 | if (!is_string($variable) || !is_string($ending) || !is_numeric($count)) { |
| 164 | 157 | return $variable; |
| 165 | 158 | } |
@@ -179,8 +172,7 @@ discard block |
||
| 179 | 172 | * @param string|mixed $ending |
| 180 | 173 | * @return string|mixed |
| 181 | 174 | */ |
| 182 | - public static function truncateWord($variable, $count = 3, $ending = '...') |
|
| 183 | - { |
|
| 175 | + public static function truncateWord($variable, $count = 3, $ending = '...') { |
|
| 184 | 176 | if (!is_string($variable) || !is_string($ending) || !is_numeric($count)) { |
| 185 | 177 | return $variable; |
| 186 | 178 | } |
@@ -199,8 +191,7 @@ discard block |
||
| 199 | 191 | * @param mixed $variable |
| 200 | 192 | * @return string|mixed |
| 201 | 193 | */ |
| 202 | - public static function upper($variable) |
|
| 203 | - { |
|
| 194 | + public static function upper($variable) { |
|
| 204 | 195 | if (!is_string($variable)) { |
| 205 | 196 | return $variable; |
| 206 | 197 | } |
@@ -217,8 +208,7 @@ discard block |
||
| 217 | 208 | * @param mixed $variable |
| 218 | 209 | * @return string|mixed |
| 219 | 210 | */ |
| 220 | - public static function urlEncode($variable) |
|
| 221 | - { |
|
| 211 | + public static function urlEncode($variable) { |
|
| 222 | 212 | if (!is_string($variable)) { |
| 223 | 213 | return $variable; |
| 224 | 214 | } |
@@ -231,8 +221,7 @@ discard block |
||
| 231 | 221 | * @param mixed $variable |
| 232 | 222 | * @return string|mixed |
| 233 | 223 | */ |
| 234 | - public static function urlDecode($variable) |
|
| 235 | - { |
|
| 224 | + public static function urlDecode($variable) { |
|
| 236 | 225 | if (!is_string($variable)) { |
| 237 | 226 | return $variable; |
| 238 | 227 | } |
@@ -245,8 +234,7 @@ discard block |
||
| 245 | 234 | * @param mixed $variable |
| 246 | 235 | * @return string|mixed |
| 247 | 236 | */ |
| 248 | - public static function stringfy($variable) |
|
| 249 | - { |
|
| 237 | + public static function stringfy($variable) { |
|
| 250 | 238 | if (is_array($variable)) { |
| 251 | 239 | return $variable; |
| 252 | 240 | } |
@@ -261,8 +249,7 @@ discard block |
||
| 261 | 249 | * @param mixed $pattern |
| 262 | 250 | * @return array<mixed>|mixed |
| 263 | 251 | */ |
| 264 | - public static function split($variable, $pattern) |
|
| 265 | - { |
|
| 252 | + public static function split($variable, $pattern) { |
|
| 266 | 253 | if (!is_string($variable) || !is_string($pattern)) { |
| 267 | 254 | return $variable; |
| 268 | 255 | } |
@@ -276,8 +263,7 @@ discard block |
||
| 276 | 263 | * @param mixed $value |
| 277 | 264 | * @return int|false|mixed |
| 278 | 265 | */ |
| 279 | - public static function find($variable, $value) |
|
| 280 | - { |
|
| 266 | + public static function find($variable, $value) { |
|
| 281 | 267 | if (!is_string($variable) || !is_string($value)) { |
| 282 | 268 | return $variable; |
| 283 | 269 | } |
@@ -290,8 +276,7 @@ discard block |
||
| 290 | 276 | * @param mixed $variable |
| 291 | 277 | * @return string|mixed |
| 292 | 278 | */ |
| 293 | - public static function raw($variable) |
|
| 294 | - { |
|
| 279 | + public static function raw($variable) { |
|
| 295 | 280 | return $variable; |
| 296 | 281 | } |
| 297 | 282 | |
@@ -300,8 +285,7 @@ discard block |
||
| 300 | 285 | * @param mixed $variable |
| 301 | 286 | * @return string|mixed |
| 302 | 287 | */ |
| 303 | - public static function escape($variable) |
|
| 304 | - { |
|
| 288 | + public static function escape($variable) { |
|
| 305 | 289 | if (!is_string($variable)) { |
| 306 | 290 | return $variable; |
| 307 | 291 | } |
@@ -314,8 +298,7 @@ discard block |
||
| 314 | 298 | * @param mixed $variable |
| 315 | 299 | * @return string|mixed |
| 316 | 300 | */ |
| 317 | - public static function escapeOnce($variable) |
|
| 318 | - { |
|
| 301 | + public static function escapeOnce($variable) { |
|
| 319 | 302 | if (!is_string($variable)) { |
| 320 | 303 | return $variable; |
| 321 | 304 | } |
@@ -329,8 +312,7 @@ discard block |
||
| 329 | 312 | * @param mixed $value |
| 330 | 313 | * @return mixed |
| 331 | 314 | */ |
| 332 | - public static function defaultValue($variable, $value) |
|
| 333 | - { |
|
| 315 | + public static function defaultValue($variable, $value) { |
|
| 334 | 316 | $isBlank = (is_string($variable) && $variable === '') |
| 335 | 317 | || is_bool($variable) && $variable === false |
| 336 | 318 | || $variable === null; |
@@ -346,8 +328,7 @@ discard block |
||
| 346 | 328 | * @param mixed $glue |
| 347 | 329 | * @return string|mixed |
| 348 | 330 | */ |
| 349 | - public static function join($variable, $glue = ' ') |
|
| 350 | - { |
|
| 331 | + public static function join($variable, $glue = ' ') { |
|
| 351 | 332 | if (!is_string($glue)) { |
| 352 | 333 | return $variable; |
| 353 | 334 | } |
@@ -375,8 +356,7 @@ discard block |
||
| 375 | 356 | * @param mixed $variable |
| 376 | 357 | * @return string|mixed |
| 377 | 358 | */ |
| 378 | - public static function lower($variable) |
|
| 379 | - { |
|
| 359 | + public static function lower($variable) { |
|
| 380 | 360 | if (!is_string($variable)) { |
| 381 | 361 | return $variable; |
| 382 | 362 | } |
@@ -393,8 +373,7 @@ discard block |
||
| 393 | 373 | * @param mixed $variable |
| 394 | 374 | * @return string|mixed |
| 395 | 375 | */ |
| 396 | - public static function capitalize($variable) |
|
| 397 | - { |
|
| 376 | + public static function capitalize($variable) { |
|
| 398 | 377 | if (!is_string($variable)) { |
| 399 | 378 | return $variable; |
| 400 | 379 | } |
@@ -413,8 +392,7 @@ discard block |
||
| 413 | 392 | * @param mixed $variable |
| 414 | 393 | * @return string|mixed |
| 415 | 394 | */ |
| 416 | - public static function lstrip($variable) |
|
| 417 | - { |
|
| 395 | + public static function lstrip($variable) { |
|
| 418 | 396 | if (!is_string($variable)) { |
| 419 | 397 | return $variable; |
| 420 | 398 | } |
@@ -427,8 +405,7 @@ discard block |
||
| 427 | 405 | * @param mixed $variable |
| 428 | 406 | * @return string|mixed |
| 429 | 407 | */ |
| 430 | - public static function rstrip($variable) |
|
| 431 | - { |
|
| 408 | + public static function rstrip($variable) { |
|
| 432 | 409 | if (!is_string($variable)) { |
| 433 | 410 | return $variable; |
| 434 | 411 | } |
@@ -441,8 +418,7 @@ discard block |
||
| 441 | 418 | * @param mixed $variable |
| 442 | 419 | * @return string|mixed |
| 443 | 420 | */ |
| 444 | - public static function strip($variable) |
|
| 445 | - { |
|
| 421 | + public static function strip($variable) { |
|
| 446 | 422 | if (!is_string($variable)) { |
| 447 | 423 | return $variable; |
| 448 | 424 | } |
@@ -455,8 +431,7 @@ discard block |
||
| 455 | 431 | * @param mixed $variable |
| 456 | 432 | * @return string|mixed |
| 457 | 433 | */ |
| 458 | - public static function stripHtml($variable) |
|
| 459 | - { |
|
| 434 | + public static function stripHtml($variable) { |
|
| 460 | 435 | if (!is_string($variable)) { |
| 461 | 436 | return $variable; |
| 462 | 437 | } |
@@ -469,8 +444,7 @@ discard block |
||
| 469 | 444 | * @param mixed $variable |
| 470 | 445 | * @return string|mixed |
| 471 | 446 | */ |
| 472 | - public static function stripNewLine($variable) |
|
| 473 | - { |
|
| 447 | + public static function stripNewLine($variable) { |
|
| 474 | 448 | if (!is_string($variable)) { |
| 475 | 449 | return $variable; |
| 476 | 450 | } |
@@ -55,16 +55,14 @@ |
||
| 55 | 55 | * Class HtmlFilter |
| 56 | 56 | * @package Platine\Template\Filter |
| 57 | 57 | */ |
| 58 | -class HtmlFilter extends AbstractFilter |
|
| 59 | -{ |
|
| 58 | +class HtmlFilter extends AbstractFilter { |
|
| 60 | 59 | |
| 61 | 60 | /** |
| 62 | 61 | * Put all letter to lower case |
| 63 | 62 | * @param mixed $variable |
| 64 | 63 | * @return string|mixed |
| 65 | 64 | */ |
| 66 | - public static function nl2br($variable) |
|
| 67 | - { |
|
| 65 | + public static function nl2br($variable) { |
|
| 68 | 66 | if (!is_string($variable)) { |
| 69 | 67 | return $variable; |
| 70 | 68 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | } else { |
| 121 | 121 | $first = reset($variable); |
| 122 | 122 | if ($first !== false && is_array($first) && array_key_exists($property, $first)) { |
| 123 | - uasort($variable, function ($a, $b) use ($property) { |
|
| 123 | + uasort($variable, function($a, $b) use ($property) { |
|
| 124 | 124 | return $a[$property] <=> $b[$property]; |
| 125 | 125 | }); |
| 126 | 126 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | return $variable; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - return array_map(function ($element) use ($property) { |
|
| 177 | + return array_map(function($element) use ($property) { |
|
| 178 | 178 | if (is_callable($element)) { |
| 179 | 179 | return $element(); |
| 180 | 180 | } elseif (is_array($element) && array_key_exists($property, $element)) { |
@@ -58,15 +58,13 @@ discard block |
||
| 58 | 58 | * Class ArrayFilter |
| 59 | 59 | * @package Platine\Template\Filter |
| 60 | 60 | */ |
| 61 | -class ArrayFilter extends AbstractFilter |
|
| 62 | -{ |
|
| 61 | +class ArrayFilter extends AbstractFilter { |
|
| 63 | 62 | /** |
| 64 | 63 | * Returns the first element of an array |
| 65 | 64 | * @param array<mixed>|Iterator<mixed>|mixed $value |
| 66 | 65 | * @return mixed |
| 67 | 66 | */ |
| 68 | - public static function first($value) |
|
| 69 | - { |
|
| 67 | + public static function first($value) { |
|
| 70 | 68 | if (is_array($value)) { |
| 71 | 69 | return reset($value); |
| 72 | 70 | } |
@@ -85,8 +83,7 @@ discard block |
||
| 85 | 83 | * @param array<mixed>|Traversable<mixed>|mixed $value |
| 86 | 84 | * @return mixed |
| 87 | 85 | */ |
| 88 | - public static function last($value) |
|
| 89 | - { |
|
| 86 | + public static function last($value) { |
|
| 90 | 87 | if (is_array($value)) { |
| 91 | 88 | return end($value); |
| 92 | 89 | } |
@@ -109,8 +106,7 @@ discard block |
||
| 109 | 106 | * @param mixed $property |
| 110 | 107 | * @return mixed |
| 111 | 108 | */ |
| 112 | - public static function sort($variable, $property = null) |
|
| 113 | - { |
|
| 109 | + public static function sort($variable, $property = null) { |
|
| 114 | 110 | if ($variable instanceof Traversable) { |
| 115 | 111 | $variable = iterator_to_array($variable); |
| 116 | 112 | } |
@@ -134,8 +130,7 @@ discard block |
||
| 134 | 130 | * @param array<int|string, mixed>|mixed $variable |
| 135 | 131 | * @return mixed |
| 136 | 132 | */ |
| 137 | - public static function sortKey($variable) |
|
| 138 | - { |
|
| 133 | + public static function sortKey($variable) { |
|
| 139 | 134 | if (is_array($variable)) { |
| 140 | 135 | ksort($variable); |
| 141 | 136 | return $variable; |
@@ -149,8 +144,7 @@ discard block |
||
| 149 | 144 | * @param array<int|string, mixed>|mixed $variable |
| 150 | 145 | * @return mixed |
| 151 | 146 | */ |
| 152 | - public static function unique($variable) |
|
| 153 | - { |
|
| 147 | + public static function unique($variable) { |
|
| 154 | 148 | if ($variable instanceof Traversable) { |
| 155 | 149 | $variable = iterator_to_array($variable); |
| 156 | 150 | } |
@@ -164,8 +158,7 @@ discard block |
||
| 164 | 158 | * @param mixed $property |
| 165 | 159 | * @return string|mixed |
| 166 | 160 | */ |
| 167 | - public static function map($variable, $property) |
|
| 168 | - { |
|
| 161 | + public static function map($variable, $property) { |
|
| 169 | 162 | if ($variable instanceof Traversable) { |
| 170 | 163 | $variable = iterator_to_array($variable); |
| 171 | 164 | } |
@@ -191,8 +184,7 @@ discard block |
||
| 191 | 184 | * @param array<mixed>|Traversable|mixed $variable |
| 192 | 185 | * @return string|mixed |
| 193 | 186 | */ |
| 194 | - public static function reverse($variable) |
|
| 195 | - { |
|
| 187 | + public static function reverse($variable) { |
|
| 196 | 188 | if ($variable instanceof Traversable) { |
| 197 | 189 | $variable = iterator_to_array($variable); |
| 198 | 190 | } |
@@ -210,8 +202,7 @@ discard block |
||
| 210 | 202 | * @param mixed $pretty whether use pretty print |
| 211 | 203 | * @return string |
| 212 | 204 | */ |
| 213 | - public static function json($variable, $pretty = false) |
|
| 214 | - { |
|
| 205 | + public static function json($variable, $pretty = false) { |
|
| 215 | 206 | $prettyPrint = boolval($pretty); |
| 216 | 207 | $options = 0; |
| 217 | 208 | if ($prettyPrint) { |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | protected string $variableName; |
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | - * {@inheritdoc} |
|
| 72 | - */ |
|
| 71 | + * {@inheritdoc} |
|
| 72 | + */ |
|
| 73 | 73 | public function __construct(string $markup, &$tokens, Parser $parser) |
| 74 | 74 | { |
| 75 | 75 | $lexer = new Lexer('/(\w+)/'); |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | - * {@inheritdoc} |
|
| 89 | - */ |
|
| 88 | + * {@inheritdoc} |
|
| 89 | + */ |
|
| 90 | 90 | public function render(Context $context): string |
| 91 | 91 | { |
| 92 | 92 | $output = parent::render($context); |
@@ -59,8 +59,7 @@ discard block |
||
| 59 | 59 | * Class CaptureTag |
| 60 | 60 | * @package Platine\Template\Tag |
| 61 | 61 | */ |
| 62 | -class CaptureTag extends AbstractBlock |
|
| 63 | -{ |
|
| 62 | +class CaptureTag extends AbstractBlock { |
|
| 64 | 63 | /** |
| 65 | 64 | * The name of the variable |
| 66 | 65 | * @var string |
@@ -70,8 +69,7 @@ discard block |
||
| 70 | 69 | /** |
| 71 | 70 | * {@inheritdoc} |
| 72 | 71 | */ |
| 73 | - public function __construct(string $markup, &$tokens, Parser $parser) |
|
| 74 | - { |
|
| 72 | + public function __construct(string $markup, &$tokens, Parser $parser) { |
|
| 75 | 73 | $lexer = new Lexer('/(\w+)/'); |
| 76 | 74 | if ($lexer->match($markup)) { |
| 77 | 75 | $this->variableName = $lexer->getStringMatch(1); |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | protected array $variables = []; |
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | - * {@inheritdoc} |
|
| 81 | - */ |
|
| 80 | + * {@inheritdoc} |
|
| 81 | + */ |
|
| 82 | 82 | public function __construct(string $markup, &$tokens, Parser $parser) |
| 83 | 83 | { |
| 84 | 84 | $lexerSimple = new Lexer('/' . Token::QUOTED_FRAGMENT . '/'); |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | - * {@inheritdoc} |
|
| 102 | - */ |
|
| 101 | + * {@inheritdoc} |
|
| 102 | + */ |
|
| 103 | 103 | public function render(Context $context): string |
| 104 | 104 | { |
| 105 | 105 | $context->push(); |
@@ -60,8 +60,7 @@ discard block |
||
| 60 | 60 | * Class CycleTag |
| 61 | 61 | * @package Platine\Template\Tag |
| 62 | 62 | */ |
| 63 | -class CycleTag extends AbstractTag |
|
| 64 | -{ |
|
| 63 | +class CycleTag extends AbstractTag { |
|
| 65 | 64 | /** |
| 66 | 65 | * The name of the cycle; if none is given one |
| 67 | 66 | * is created using the value list |
@@ -78,8 +77,7 @@ discard block |
||
| 78 | 77 | /** |
| 79 | 78 | * {@inheritdoc} |
| 80 | 79 | */ |
| 81 | - public function __construct(string $markup, &$tokens, Parser $parser) |
|
| 82 | - { |
|
| 80 | + public function __construct(string $markup, &$tokens, Parser $parser) { |
|
| 83 | 81 | $lexerSimple = new Lexer('/' . Token::QUOTED_FRAGMENT . '/'); |
| 84 | 82 | $lexerNamed = new Lexer('/(' . Token::QUOTED_FRAGMENT . ')\s*\:\s*(.*)/'); |
| 85 | 83 | if ($lexerNamed->match($markup)) { |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | protected string $hash; |
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | - * {@inheritdoc} |
|
| 87 | - */ |
|
| 86 | + * {@inheritdoc} |
|
| 87 | + */ |
|
| 88 | 88 | public function __construct(string $markup, &$tokens, Parser $parser) |
| 89 | 89 | { |
| 90 | 90 | $lexer = new Lexer('/("[^"]+"|\'[^\']+\')?/'); |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
| 108 | - * {@inheritdoc} |
|
| 109 | - */ |
|
| 108 | + * {@inheritdoc} |
|
| 109 | + */ |
|
| 110 | 110 | public function parse(&$tokens): void |
| 111 | 111 | { |
| 112 | 112 | $source = $this->parser->getLoader()->read($this->templateName); |
@@ -187,8 +187,8 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | |
| 189 | 189 | /** |
| 190 | - * {@inheritdoc} |
|
| 191 | - */ |
|
| 190 | + * {@inheritdoc} |
|
| 191 | + */ |
|
| 192 | 192 | public function render(Context $context): string |
| 193 | 193 | { |
| 194 | 194 | $context->push(); |
@@ -61,8 +61,7 @@ discard block |
||
| 61 | 61 | * Class ExtendsTag |
| 62 | 62 | * @package Platine\Template\Tag |
| 63 | 63 | */ |
| 64 | -class ExtendsTag extends AbstractTag |
|
| 65 | -{ |
|
| 64 | +class ExtendsTag extends AbstractTag { |
|
| 66 | 65 | /** |
| 67 | 66 | * The name of the template |
| 68 | 67 | * @var string |
@@ -84,8 +83,7 @@ discard block |
||
| 84 | 83 | /** |
| 85 | 84 | * {@inheritdoc} |
| 86 | 85 | */ |
| 87 | - public function __construct(string $markup, &$tokens, Parser $parser) |
|
| 88 | - { |
|
| 86 | + public function __construct(string $markup, &$tokens, Parser $parser) { |
|
| 89 | 87 | $lexer = new Lexer('/("[^"]+"|\'[^\']+\')?/'); |
| 90 | 88 | if ($lexer->match($markup) && $lexer->isMatchNotNull(1)) { |
| 91 | 89 | $this->templateName = substr( |
@@ -67,16 +67,16 @@ |
||
| 67 | 67 | protected string $lastValue = ''; |
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | - * {@inheritdoc} |
|
| 71 | - */ |
|
| 70 | + * {@inheritdoc} |
|
| 71 | + */ |
|
| 72 | 72 | public function __construct(string $markup, &$tokens, Parser $parser) |
| 73 | 73 | { |
| 74 | 74 | parent::__construct($markup, $tokens, $parser); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | - * {@inheritdoc} |
|
| 79 | - */ |
|
| 78 | + * {@inheritdoc} |
|
| 79 | + */ |
|
| 80 | 80 | public function render(Context $context): string |
| 81 | 81 | { |
| 82 | 82 | $output = parent::render($context); |
@@ -57,8 +57,7 @@ discard block |
||
| 57 | 57 | * Class IfchangedTag |
| 58 | 58 | * @package Platine\Template\Tag |
| 59 | 59 | */ |
| 60 | -class IfchangedTag extends AbstractBlock |
|
| 61 | -{ |
|
| 60 | +class IfchangedTag extends AbstractBlock { |
|
| 62 | 61 | /** |
| 63 | 62 | * The last value |
| 64 | 63 | * @var string |
@@ -68,8 +67,7 @@ discard block |
||
| 68 | 67 | /** |
| 69 | 68 | * {@inheritdoc} |
| 70 | 69 | */ |
| 71 | - public function __construct(string $markup, &$tokens, Parser $parser) |
|
| 72 | - { |
|
| 70 | + public function __construct(string $markup, &$tokens, Parser $parser) { |
|
| 73 | 71 | parent::__construct($markup, $tokens, $parser); |
| 74 | 72 | } |
| 75 | 73 | |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | protected $start; |
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | - * {@inheritdoc} |
|
| 111 | - */ |
|
| 110 | + * {@inheritdoc} |
|
| 111 | + */ |
|
| 112 | 112 | public function __construct(string $markup, &$tokens, Parser $parser) |
| 113 | 113 | { |
| 114 | 114 | parent::__construct($markup, $tokens, $parser); |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
| 147 | - * {@inheritdoc} |
|
| 148 | - */ |
|
| 147 | + * {@inheritdoc} |
|
| 148 | + */ |
|
| 149 | 149 | public function render(Context $context): string |
| 150 | 150 | { |
| 151 | 151 | if (!$context->hasRegister('for')) { |
@@ -196,8 +196,8 @@ discard block |
||
| 196 | 196 | 'index0' => $index, |
| 197 | 197 | 'rindex' => $length - $index, |
| 198 | 198 | 'rindex0' => $length - $index - 1, |
| 199 | - 'first' => ((int)$index === 0), |
|
| 200 | - 'last' => ((int)$index === ($length - 1)), |
|
| 199 | + 'first' => ((int) $index === 0), |
|
| 200 | + 'last' => ((int) $index === ($length - 1)), |
|
| 201 | 201 | ]); |
| 202 | 202 | |
| 203 | 203 | $result .= $this->renderAll($this->nodeList, $context); |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | $offset = 0; |
| 247 | 247 | if (isset($this->attributes['offset'])) { |
| 248 | 248 | $forRegister = $context->getRegister('for'); |
| 249 | - $offset = ($this->attributes['offset'] === 'continue') |
|
| 249 | + $offset = ($this->attributes['offset'] === 'continue') |
|
| 250 | 250 | ? (isset($forRegister[$this->name]) |
| 251 | 251 | ? (int) $forRegister[$this->name] |
| 252 | 252 | : 0) |
@@ -283,8 +283,8 @@ discard block |
||
| 283 | 283 | 'index0' => $index, |
| 284 | 284 | 'rindex' => $length - $index, |
| 285 | 285 | 'rindex0' => $length - $index - 1, |
| 286 | - 'first' => ((int)$index === 0), |
|
| 287 | - 'last' => ((int)$index === ($length - 1)), |
|
| 286 | + 'first' => ((int) $index === 0), |
|
| 287 | + 'last' => ((int) $index === ($length - 1)), |
|
| 288 | 288 | ]); |
| 289 | 289 | |
| 290 | 290 | $result .= $this->renderAll($this->nodeList, $context); |
@@ -62,8 +62,7 @@ discard block |
||
| 62 | 62 | * Class ForTag |
| 63 | 63 | * @package Platine\Template\Tag |
| 64 | 64 | */ |
| 65 | -class ForTag extends AbstractBlock |
|
| 66 | -{ |
|
| 65 | +class ForTag extends AbstractBlock { |
|
| 67 | 66 | /** |
| 68 | 67 | * Type digit |
| 69 | 68 | */ |
@@ -108,8 +107,7 @@ discard block |
||
| 108 | 107 | /** |
| 109 | 108 | * {@inheritdoc} |
| 110 | 109 | */ |
| 111 | - public function __construct(string $markup, &$tokens, Parser $parser) |
|
| 112 | - { |
|
| 110 | + public function __construct(string $markup, &$tokens, Parser $parser) { |
|
| 113 | 111 | parent::__construct($markup, $tokens, $parser); |
| 114 | 112 | |
| 115 | 113 | $lexerCollection = new Lexer('/(\w+)\s+in\s+(' . Token::VARIABLE_NAME . ')/'); |