@@ -55,8 +55,7 @@ discard block |
||
55 | 55 | * Class NumberFilter |
56 | 56 | * @package Platine\Template\Filter |
57 | 57 | */ |
58 | -class NumberFilter extends AbstractFilter |
|
59 | -{ |
|
58 | +class NumberFilter extends AbstractFilter { |
|
60 | 59 | |
61 | 60 | /** |
62 | 61 | * Addition |
@@ -64,8 +63,7 @@ discard block |
||
64 | 63 | * @param mixed $operand |
65 | 64 | * @return float|int|mixed |
66 | 65 | */ |
67 | - public static function plus($variable, $operand) |
|
68 | - { |
|
66 | + public static function plus($variable, $operand) { |
|
69 | 67 | if (!is_numeric($variable) || !is_numeric($operand)) { |
70 | 68 | return $variable; |
71 | 69 | } |
@@ -83,8 +81,7 @@ discard block |
||
83 | 81 | * @param mixed $operand |
84 | 82 | * @return int|float|mixed |
85 | 83 | */ |
86 | - public static function minus($variable, $operand) |
|
87 | - { |
|
84 | + public static function minus($variable, $operand) { |
|
88 | 85 | if (!is_numeric($variable) || !is_numeric($operand)) { |
89 | 86 | return $variable; |
90 | 87 | } |
@@ -102,8 +99,7 @@ discard block |
||
102 | 99 | * @param mixed $operand |
103 | 100 | * @return int|float|mixed |
104 | 101 | */ |
105 | - public static function times($variable, $operand) |
|
106 | - { |
|
102 | + public static function times($variable, $operand) { |
|
107 | 103 | if (!is_numeric($variable) || !is_numeric($operand)) { |
108 | 104 | return $variable; |
109 | 105 | } |
@@ -121,8 +117,7 @@ discard block |
||
121 | 117 | * @param mixed $operand |
122 | 118 | * @return int|float|mixed |
123 | 119 | */ |
124 | - public static function modulo($variable, $operand) |
|
125 | - { |
|
120 | + public static function modulo($variable, $operand) { |
|
126 | 121 | if (!is_numeric($variable) || !is_numeric($operand)) { |
127 | 122 | return $variable; |
128 | 123 | } |
@@ -140,8 +135,7 @@ discard block |
||
140 | 135 | * @param mixed $number |
141 | 136 | * @return float|mixed |
142 | 137 | */ |
143 | - public static function round($variable, $number = 0) |
|
144 | - { |
|
138 | + public static function round($variable, $number = 0) { |
|
145 | 139 | if (!is_numeric($variable) || !is_numeric($number)) { |
146 | 140 | return $variable; |
147 | 141 | } |
@@ -55,8 +55,7 @@ discard block |
||
55 | 55 | * Class Configuration |
56 | 56 | * @package Platine\Template |
57 | 57 | */ |
58 | -class Configuration |
|
59 | -{ |
|
58 | +class Configuration { |
|
60 | 59 | |
61 | 60 | /** |
62 | 61 | * The configuration raw data |
@@ -123,8 +122,7 @@ discard block |
||
123 | 122 | * Create new instance |
124 | 123 | * @param array<string, mixed> $config |
125 | 124 | */ |
126 | - public function __construct(array $config = []) |
|
127 | - { |
|
125 | + public function __construct(array $config = []) { |
|
128 | 126 | $this->load($config); |
129 | 127 | } |
130 | 128 | |
@@ -133,8 +131,7 @@ discard block |
||
133 | 131 | * @param string $name |
134 | 132 | * @return mixed |
135 | 133 | */ |
136 | - public function get(string $name) |
|
137 | - { |
|
134 | + public function get(string $name) { |
|
138 | 135 | if (!array_key_exists($name, $this->config)) { |
139 | 136 | throw new InvalidArgumentException(sprintf( |
140 | 137 | 'Invalid configuration [%s]', |
@@ -53,8 +53,7 @@ |
||
53 | 53 | * Class Helper |
54 | 54 | * @package Platine\Template\Util |
55 | 55 | */ |
56 | -class Helper |
|
57 | -{ |
|
56 | +class Helper { |
|
58 | 57 | |
59 | 58 | /** |
60 | 59 | * Normalize path |
@@ -62,8 +62,8 @@ |
||
62 | 62 | |
63 | 63 | |
64 | 64 | /** |
65 | - * {@inheritdoc} |
|
66 | - */ |
|
65 | + * {@inheritdoc} |
|
66 | + */ |
|
67 | 67 | public function parse(array &$tokens): void |
68 | 68 | { |
69 | 69 | $lexer = new Lexer( |
@@ -57,8 +57,7 @@ |
||
57 | 57 | * Class RawTag |
58 | 58 | * @package Platine\Template\Tag |
59 | 59 | */ |
60 | -class RawTag extends AbstractBlock |
|
61 | -{ |
|
60 | +class RawTag extends AbstractBlock { |
|
62 | 61 | |
63 | 62 | |
64 | 63 | /** |
@@ -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 | /** |
67 | 66 | * The name of the cycle; if none is given one |
@@ -79,8 +78,7 @@ discard block |
||
79 | 78 | /** |
80 | 79 | * {@inheritdoc} |
81 | 80 | */ |
82 | - public function __construct(string $markup, &$tokens, Parser $parser) |
|
83 | - { |
|
81 | + public function __construct(string $markup, &$tokens, Parser $parser) { |
|
84 | 82 | $lexerSimple = new Lexer('/' . Token::QUOTED_FRAGMENT . '/'); |
85 | 83 | $lexerNamed = new Lexer('/(' . Token::QUOTED_FRAGMENT . ')\s*\:\s*(.*)/'); |
86 | 84 | 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 | /** |
68 | 67 | * The name of the template |
@@ -85,8 +84,7 @@ discard block |
||
85 | 84 | /** |
86 | 85 | * {@inheritdoc} |
87 | 86 | */ |
88 | - public function __construct(string $markup, &$tokens, Parser $parser) |
|
89 | - { |
|
87 | + public function __construct(string $markup, &$tokens, Parser $parser) { |
|
90 | 88 | $lexer = new Lexer('/("[^"]+"|\'[^\']+\')?/'); |
91 | 89 | if ($lexer->match($markup) && $lexer->isMatchNotNull(1)) { |
92 | 90 | $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 | /** |
64 | 63 | * The last value |
@@ -69,8 +68,7 @@ discard block |
||
69 | 68 | /** |
70 | 69 | * {@inheritdoc} |
71 | 70 | */ |
72 | - public function __construct(string $markup, &$tokens, Parser $parser) |
|
73 | - { |
|
71 | + public function __construct(string $markup, &$tokens, Parser $parser) { |
|
74 | 72 | parent::__construct($markup, $tokens, $parser); |
75 | 73 | } |
76 | 74 |
@@ -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 | /** |
69 | 68 | * Type digit |
@@ -109,8 +108,7 @@ discard block |
||
109 | 108 | /** |
110 | 109 | * {@inheritdoc} |
111 | 110 | */ |
112 | - public function __construct(string $markup, &$tokens, Parser $parser) |
|
113 | - { |
|
111 | + public function __construct(string $markup, &$tokens, Parser $parser) { |
|
114 | 112 | parent::__construct($markup, $tokens, $parser); |
115 | 113 | |
116 | 114 | $lexerCollection = new Lexer('/(\w+)\s+in\s+(' . Token::VARIABLE_NAME . ')/'); |