@@ -56,8 +56,8 @@ |
||
56 | 56 | class IfnotTag extends IfTag |
57 | 57 | { |
58 | 58 | /** |
59 | - * {@inheritdoc} |
|
60 | - */ |
|
59 | + * {@inheritdoc} |
|
60 | + */ |
|
61 | 61 | protected function negateCondition(mixed $value): mixed |
62 | 62 | { |
63 | 63 | return !$value; |
@@ -53,8 +53,7 @@ |
||
53 | 53 | * @class IfnotTag |
54 | 54 | * @package Platine\Template\Tag |
55 | 55 | */ |
56 | -class IfnotTag extends IfTag |
|
57 | -{ |
|
56 | +class IfnotTag extends IfTag { |
|
58 | 57 | /** |
59 | 58 | * {@inheritdoc} |
60 | 59 | */ |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * The loop start value |
104 | 104 | * @var int|string |
105 | 105 | */ |
106 | - protected int|string $start; |
|
106 | + protected int | string $start; |
|
107 | 107 | |
108 | 108 | /** |
109 | 109 | * {@inheritdoc} |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | 'index0' => $index, |
195 | 195 | 'rindex' => $length - $index, |
196 | 196 | 'rindex0' => $length - $index - 1, |
197 | - 'first' => ((int)$index === 0), |
|
198 | - 'last' => ((int)$index === ($length - 1)), |
|
197 | + 'first' => ((int) $index === 0), |
|
198 | + 'last' => ((int) $index === ($length - 1)), |
|
199 | 199 | ]); |
200 | 200 | |
201 | 201 | $result .= $this->renderAll($this->nodeList, $context); |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | $offset = 0; |
245 | 245 | if (isset($this->attributes['offset'])) { |
246 | 246 | $forRegister = $context->getRegister('for'); |
247 | - $offset = ($this->attributes['offset'] === 'continue') |
|
247 | + $offset = ($this->attributes['offset'] === 'continue') |
|
248 | 248 | ? (isset($forRegister[$this->name]) |
249 | 249 | ? (int) $forRegister[$this->name] |
250 | 250 | : 0) |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | 'index0' => $index, |
282 | 282 | 'rindex' => $length - $index, |
283 | 283 | 'rindex0' => $length - $index - 1, |
284 | - 'first' => ((int)$index === 0), |
|
285 | - 'last' => ((int)$index === ($length - 1)), |
|
284 | + 'first' => ((int) $index === 0), |
|
285 | + 'last' => ((int) $index === ($length - 1)), |
|
286 | 286 | ]); |
287 | 287 | |
288 | 288 | $result .= $this->renderAll($this->nodeList, $context); |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | protected int|string $start; |
107 | 107 | |
108 | 108 | /** |
109 | - * {@inheritdoc} |
|
110 | - */ |
|
109 | + * {@inheritdoc} |
|
110 | + */ |
|
111 | 111 | public function __construct(string $markup, array &$tokens, Parser $parser) |
112 | 112 | { |
113 | 113 | parent::__construct($markup, $tokens, $parser); |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
146 | - * {@inheritdoc} |
|
147 | - */ |
|
146 | + * {@inheritdoc} |
|
147 | + */ |
|
148 | 148 | public function render(Context $context): string |
149 | 149 | { |
150 | 150 | if (!$context->hasRegister('for')) { |
@@ -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, array &$tokens, Parser $parser) |
|
112 | - { |
|
110 | + public function __construct(string $markup, array &$tokens, Parser $parser) { |
|
113 | 111 | parent::__construct($markup, $tokens, $parser); |
114 | 112 | |
115 | 113 | $lexerCollection = new Lexer('/(\w+)\s+in\s+(' . Token::VARIABLE_NAME . ')/'); |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
76 | - * {@inheritdoc} |
|
77 | - */ |
|
76 | + * {@inheritdoc} |
|
77 | + */ |
|
78 | 78 | public function read(string $key, bool $unserialize = true): mixed |
79 | 79 | { |
80 | 80 | $success = false; |
@@ -84,16 +84,16 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
87 | - * {@inheritdoc} |
|
88 | - */ |
|
87 | + * {@inheritdoc} |
|
88 | + */ |
|
89 | 89 | public function exists(string $key): bool |
90 | 90 | { |
91 | 91 | return apcu_exists($this->prefix . $key) === true; |
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
95 | - * {@inheritdoc} |
|
96 | - */ |
|
95 | + * {@inheritdoc} |
|
96 | + */ |
|
97 | 97 | public function write(string $key, mixed $value, bool $serialize = true): bool |
98 | 98 | { |
99 | 99 | return apcu_store($this->prefix . $key, $value, $this->expire); |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | |
102 | 102 | |
103 | 103 | /** |
104 | - * {@inheritdoc} |
|
105 | - */ |
|
104 | + * {@inheritdoc} |
|
105 | + */ |
|
106 | 106 | public function flush(bool $expired = false): bool |
107 | 107 | { |
108 | 108 | return apcu_clear_cache(); |
@@ -56,14 +56,12 @@ |
||
56 | 56 | * @class ApcCache |
57 | 57 | * @package Platine\Template\Cache |
58 | 58 | */ |
59 | -class ApcCache extends AbstractCache |
|
60 | -{ |
|
59 | +class ApcCache extends AbstractCache { |
|
61 | 60 | /** |
62 | 61 | * Create new instance |
63 | 62 | * @param Configuration|null $config |
64 | 63 | */ |
65 | - public function __construct(?Configuration $config = null) |
|
66 | - { |
|
64 | + public function __construct(?Configuration $config = null) { |
|
67 | 65 | parent::__construct($config); |
68 | 66 | |
69 | 67 | if ((!extension_loaded('apcu')) || !((bool) ini_get('apc.enabled'))) { |
@@ -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): mixed |
68 | 68 | { |
69 | 69 | if ($this->exists($key) === false) { |
@@ -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, mixed $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 @@ |
||
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> |
@@ -55,8 +55,7 @@ discard block |
||
55 | 55 | * @class AbstractCache |
56 | 56 | * @package Platine\Template\Cache |
57 | 57 | */ |
58 | -abstract class AbstractCache |
|
59 | -{ |
|
58 | +abstract class AbstractCache { |
|
60 | 59 | /** |
61 | 60 | * The cache expiration in second |
62 | 61 | * @var int |
@@ -79,8 +78,7 @@ discard block |
||
79 | 78 | * Create new instance |
80 | 79 | * @param Configuration|null $config |
81 | 80 | */ |
82 | - public function __construct(?Configuration $config = null) |
|
83 | - { |
|
81 | + public function __construct(?Configuration $config = null) { |
|
84 | 82 | $this->config = $config ?? new Configuration([]); |
85 | 83 | |
86 | 84 | $this->expire = $this->config->get('cache_expire'); |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
90 | - * {@inheritdoc} |
|
91 | - */ |
|
90 | + * {@inheritdoc} |
|
91 | + */ |
|
92 | 92 | public function read(string $key, bool $unserialize = true): mixed |
93 | 93 | { |
94 | 94 | if ($this->exists($key) === false) { |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
108 | - * {@inheritdoc} |
|
109 | - */ |
|
108 | + * {@inheritdoc} |
|
109 | + */ |
|
110 | 110 | public function exists(string $key): bool |
111 | 111 | { |
112 | 112 | $file = $this->getFilePath($key); |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
122 | - * {@inheritdoc} |
|
123 | - */ |
|
122 | + * {@inheritdoc} |
|
123 | + */ |
|
124 | 124 | public function write(string $key, mixed $value, bool $serialize = true): bool |
125 | 125 | { |
126 | 126 | $file = $this->getFilePath($key); |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | |
138 | 138 | |
139 | 139 | /** |
140 | - * {@inheritdoc} |
|
141 | - */ |
|
140 | + * {@inheritdoc} |
|
141 | + */ |
|
142 | 142 | public function flush(bool $expired = false): bool |
143 | 143 | { |
144 | 144 | $list = glob(sprintf('%s%s*', $this->path, $this->prefix)); |
@@ -57,8 +57,7 @@ discard block |
||
57 | 57 | * @class FileCache |
58 | 58 | * @package Platine\Template\Cache |
59 | 59 | */ |
60 | -class FileCache extends AbstractCache |
|
61 | -{ |
|
60 | +class FileCache extends AbstractCache { |
|
62 | 61 | /** |
63 | 62 | * The cache directory to use |
64 | 63 | * @var string |
@@ -69,8 +68,7 @@ discard block |
||
69 | 68 | * Create new instance |
70 | 69 | * @param Configuration|null $config |
71 | 70 | */ |
72 | - public function __construct(?Configuration $config = null) |
|
73 | - { |
|
71 | + public function __construct(?Configuration $config = null) { |
|
74 | 72 | parent::__construct($config); |
75 | 73 | $dir = $this->config->get('cache_dir'); |
76 | 74 | $path = Helper::normalizePath($dir); |
@@ -56,24 +56,24 @@ discard block |
||
56 | 56 | class NullCache extends AbstractCache |
57 | 57 | { |
58 | 58 | /** |
59 | - * {@inheritdoc} |
|
60 | - */ |
|
59 | + * {@inheritdoc} |
|
60 | + */ |
|
61 | 61 | public function read(string $key, bool $unserialize = false): mixed |
62 | 62 | { |
63 | 63 | return false; |
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
67 | - * {@inheritdoc} |
|
68 | - */ |
|
67 | + * {@inheritdoc} |
|
68 | + */ |
|
69 | 69 | public function exists(string $key): bool |
70 | 70 | { |
71 | 71 | return false; |
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
75 | - * {@inheritdoc} |
|
76 | - */ |
|
75 | + * {@inheritdoc} |
|
76 | + */ |
|
77 | 77 | public function write(string $key, mixed $value, bool $serialize = false): bool |
78 | 78 | { |
79 | 79 | return true; |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | |
82 | 82 | |
83 | 83 | /** |
84 | - * {@inheritdoc} |
|
85 | - */ |
|
84 | + * {@inheritdoc} |
|
85 | + */ |
|
86 | 86 | public function flush(bool $expired = false): bool |
87 | 87 | { |
88 | 88 | return true; |
@@ -53,8 +53,7 @@ |
||
53 | 53 | * @class NullCache |
54 | 54 | * @package Platine\Template\Cache |
55 | 55 | */ |
56 | -class NullCache extends AbstractCache |
|
57 | -{ |
|
56 | +class NullCache extends AbstractCache { |
|
58 | 57 | /** |
59 | 58 | * {@inheritdoc} |
60 | 59 | */ |
@@ -55,8 +55,7 @@ |
||
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 | * Replace new line to <br /> |
62 | 61 | * @param mixed $variable |
@@ -64,7 +64,7 @@ |
||
64 | 64 | * @param string $format |
65 | 65 | * @return string|mixed |
66 | 66 | */ |
67 | - public static function date(string|DateTimeInterface|int|null $variable, string $format): mixed |
|
67 | + public static function date(string | DateTimeInterface | int | null $variable, string $format): mixed |
|
68 | 68 | { |
69 | 69 | if ($variable === null) { |
70 | 70 | return null; |
@@ -56,8 +56,7 @@ |
||
56 | 56 | * @class DatetimeFilter |
57 | 57 | * @package Platine\Template\Filter |
58 | 58 | */ |
59 | -class DatetimeFilter extends AbstractFilter |
|
60 | -{ |
|
59 | +class DatetimeFilter extends AbstractFilter { |
|
61 | 60 | /** |
62 | 61 | * Formats a date |
63 | 62 | * @param string|DateTimeInterface|int|null $variable |