@@ -45,44 +45,44 @@ discard block |
||
45 | 45 | |
46 | 46 | public const META_URL_ENCODING = 'url_encoding'; |
47 | 47 | |
48 | - /** |
|
49 | - * @var string |
|
50 | - */ |
|
48 | + /** |
|
49 | + * @var string |
|
50 | + */ |
|
51 | 51 | protected string $type = ''; |
52 | 52 | |
53 | - /** |
|
54 | - * @var string |
|
55 | - */ |
|
53 | + /** |
|
54 | + * @var string |
|
55 | + */ |
|
56 | 56 | protected string $paramsString = ''; |
57 | 57 | |
58 | - /** |
|
59 | - * @var string |
|
60 | - */ |
|
58 | + /** |
|
59 | + * @var string |
|
60 | + */ |
|
61 | 61 | protected string $matchedText = ''; |
62 | 62 | |
63 | - /** |
|
64 | - * @var string |
|
65 | - */ |
|
63 | + /** |
|
64 | + * @var string |
|
65 | + */ |
|
66 | 66 | protected string $hash = ''; |
67 | 67 | |
68 | - /** |
|
69 | - * @var OperationResult |
|
70 | - */ |
|
68 | + /** |
|
69 | + * @var OperationResult |
|
70 | + */ |
|
71 | 71 | protected OperationResult $validationResult; |
72 | 72 | |
73 | - /** |
|
74 | - * @var Mailcode |
|
75 | - */ |
|
73 | + /** |
|
74 | + * @var Mailcode |
|
75 | + */ |
|
76 | 76 | protected Mailcode $mailcode; |
77 | 77 | |
78 | - /** |
|
79 | - * @var Mailcode_Parser_Statement|NULL |
|
80 | - */ |
|
78 | + /** |
|
79 | + * @var Mailcode_Parser_Statement|NULL |
|
80 | + */ |
|
81 | 81 | protected ?Mailcode_Parser_Statement $params = null; |
82 | 82 | |
83 | - /** |
|
84 | - * @var string[] |
|
85 | - */ |
|
83 | + /** |
|
84 | + * @var string[] |
|
85 | + */ |
|
86 | 86 | protected array $validations = array( |
87 | 87 | Mailcode_Interfaces_Commands_Validation_EmptyParams::VALIDATION_NAME_EMPTY_PARAMS, |
88 | 88 | Mailcode_Interfaces_Commands_Validation_ParamKeywords::VALIDATION_NAME_KEYWORDS, |
@@ -91,24 +91,24 @@ discard block |
||
91 | 91 | Mailcode_Interfaces_Commands_Validation_TypeUnsupported::VALIDATION_NAME_TYPE_UNSUPPORTED |
92 | 92 | ); |
93 | 93 | |
94 | - /** |
|
95 | - * @var string |
|
96 | - */ |
|
94 | + /** |
|
95 | + * @var string |
|
96 | + */ |
|
97 | 97 | protected string $comment = ''; |
98 | 98 | |
99 | - /** |
|
100 | - * @var Mailcode_Commands_LogicKeywords|NULL |
|
101 | - */ |
|
99 | + /** |
|
100 | + * @var Mailcode_Commands_LogicKeywords|NULL |
|
101 | + */ |
|
102 | 102 | protected ?Mailcode_Commands_LogicKeywords $logicKeywords = null; |
103 | 103 | |
104 | - /** |
|
105 | - * @var Mailcode_Parser_Statement_Validator|NULL |
|
106 | - */ |
|
104 | + /** |
|
105 | + * @var Mailcode_Parser_Statement_Validator|NULL |
|
106 | + */ |
|
107 | 107 | protected ?Mailcode_Parser_Statement_Validator $validator = null; |
108 | 108 | |
109 | - /** |
|
110 | - * @var boolean |
|
111 | - */ |
|
109 | + /** |
|
110 | + * @var boolean |
|
111 | + */ |
|
112 | 112 | private bool $validated = false; |
113 | 113 | |
114 | 114 | /** |
@@ -143,13 +143,13 @@ discard block |
||
143 | 143 | |
144 | 144 | } |
145 | 145 | |
146 | - /** |
|
147 | - * Sets the command's parent opening command, if any. |
|
148 | - * NOTE: This is set automatically by the parser, and |
|
149 | - * should not be called manually. |
|
150 | - * |
|
151 | - * @param Mailcode_Commands_Command $command |
|
152 | - */ |
|
146 | + /** |
|
147 | + * Sets the command's parent opening command, if any. |
|
148 | + * NOTE: This is set automatically by the parser, and |
|
149 | + * should not be called manually. |
|
150 | + * |
|
151 | + * @param Mailcode_Commands_Command $command |
|
152 | + */ |
|
153 | 153 | public function setParent(Mailcode_Commands_Command $command) : void |
154 | 154 | { |
155 | 155 | $this->parent = $command; |
@@ -295,9 +295,9 @@ discard block |
||
295 | 295 | return $this->validationResult->isValid(); |
296 | 296 | } |
297 | 297 | |
298 | - /** |
|
299 | - * @return string[] |
|
300 | - */ |
|
298 | + /** |
|
299 | + * @return string[] |
|
300 | + */ |
|
301 | 301 | abstract protected function getValidations() : array; |
302 | 302 | |
303 | 303 | protected function _validateNesting() : void |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | private int $instanceID; |
134 | 134 | |
135 | - public function __construct(string $type='', string $paramsString='', string $matchedText='') |
|
135 | + public function __construct(string $type = '', string $paramsString = '', string $matchedText = '') |
|
136 | 136 | { |
137 | 137 | self::$instanceCounter++; |
138 | 138 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | { |
224 | 224 | $this->requireNonDummy(); |
225 | 225 | |
226 | - if($this->hash === '') { |
|
226 | + if ($this->hash === '') { |
|
227 | 227 | $this->hash = md5($this->matchedText); |
228 | 228 | } |
229 | 229 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | */ |
237 | 237 | protected function requireNonDummy() : void |
238 | 238 | { |
239 | - if(!$this->isDummy()) |
|
239 | + if (!$this->isDummy()) |
|
240 | 240 | { |
241 | 241 | return; |
242 | 242 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | protected function validate() : OperationResult |
257 | 257 | { |
258 | - if(!$this->validated) |
|
258 | + if (!$this->validated) |
|
259 | 259 | { |
260 | 260 | $this->requireNonDummy(); |
261 | 261 | $this->validateSyntax(); |
@@ -275,10 +275,10 @@ discard block |
||
275 | 275 | { |
276 | 276 | $validations = $this->resolveValidations(); |
277 | 277 | |
278 | - foreach($validations as $validation) |
|
278 | + foreach ($validations as $validation) |
|
279 | 279 | { |
280 | 280 | // break off at the first validation issue |
281 | - if(!$this->validateSyntaxMethod($validation)) |
|
281 | + if (!$this->validateSyntaxMethod($validation)) |
|
282 | 282 | { |
283 | 283 | return; |
284 | 284 | } |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | { |
303 | 303 | $method = 'validateSyntax_'.$validation; |
304 | 304 | |
305 | - if(!method_exists($this, $method)) |
|
305 | + if (!method_exists($this, $method)) |
|
306 | 306 | { |
307 | 307 | throw new CommandException( |
308 | 308 | 'Missing validation method ['.$validation.']', |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | |
333 | 333 | public function validateNesting() : OperationResult |
334 | 334 | { |
335 | - if($this->nestingValidated) |
|
335 | + if ($this->nestingValidated) |
|
336 | 336 | { |
337 | 337 | return $this->validationResult; |
338 | 338 | } |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | |
357 | 357 | public function getType() : string |
358 | 358 | { |
359 | - if($this->supportsType()) |
|
359 | + if ($this->supportsType()) |
|
360 | 360 | { |
361 | 361 | return $this->type; |
362 | 362 | } |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | |
377 | 377 | public function getHighlighted() : string |
378 | 378 | { |
379 | - if(!$this->isValid()) |
|
379 | + if (!$this->isValid()) |
|
380 | 380 | { |
381 | 381 | return ''; |
382 | 382 | } |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | public function getParamsString() : string |
388 | 388 | { |
389 | - if($this->requiresParameters()) |
|
389 | + if ($this->requiresParameters()) |
|
390 | 390 | { |
391 | 391 | return $this->paramsString; |
392 | 392 | } |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | */ |
406 | 406 | public function requireParams() : Mailcode_Parser_Statement |
407 | 407 | { |
408 | - if(isset($this->params)) |
|
408 | + if (isset($this->params)) |
|
409 | 409 | { |
410 | 410 | return $this->params; |
411 | 411 | } |
@@ -437,22 +437,22 @@ discard block |
||
437 | 437 | */ |
438 | 438 | final public function getCommandType() : string |
439 | 439 | { |
440 | - if($this instanceof Mailcode_Commands_Command_Type_Closing) |
|
440 | + if ($this instanceof Mailcode_Commands_Command_Type_Closing) |
|
441 | 441 | { |
442 | 442 | return 'Closing'; |
443 | 443 | } |
444 | 444 | |
445 | - if($this instanceof Mailcode_Commands_Command_Type_Opening) |
|
445 | + if ($this instanceof Mailcode_Commands_Command_Type_Opening) |
|
446 | 446 | { |
447 | 447 | return 'Opening'; |
448 | 448 | } |
449 | 449 | |
450 | - if($this instanceof Mailcode_Commands_Command_Type_Sibling) |
|
450 | + if ($this instanceof Mailcode_Commands_Command_Type_Sibling) |
|
451 | 451 | { |
452 | 452 | return 'Sibling'; |
453 | 453 | } |
454 | 454 | |
455 | - if($this instanceof Mailcode_Commands_Command_Type_Standalone) |
|
455 | + if ($this instanceof Mailcode_Commands_Command_Type_Standalone) |
|
456 | 456 | { |
457 | 457 | return 'Standalone'; |
458 | 458 | } |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | */ |
494 | 494 | public function getLogicKeywords() : Mailcode_Commands_LogicKeywords |
495 | 495 | { |
496 | - if(isset($this->logicKeywords) && $this->supportsLogicKeywords()) |
|
496 | + if (isset($this->logicKeywords) && $this->supportsLogicKeywords()) |
|
497 | 497 | { |
498 | 498 | return $this->logicKeywords; |
499 | 499 | } |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | |
524 | 524 | protected function getValidator() : Mailcode_Parser_Statement_Validator |
525 | 525 | { |
526 | - if(isset($this->validator)) |
|
526 | + if (isset($this->validator)) |
|
527 | 527 | { |
528 | 528 | return $this->validator; |
529 | 529 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | public function __construct(Mailcode_Commands_Command $command) |
41 | 41 | { |
42 | - if(!$command instanceof Mailcode_Interfaces_Commands_ProtectedContent) |
|
42 | + if (!$command instanceof Mailcode_Interfaces_Commands_ProtectedContent) |
|
43 | 43 | { |
44 | 44 | throw new Mailcode_Exception( |
45 | 45 | 'Invalid command', |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | { |
67 | 67 | $params = $command->getParams(); |
68 | 68 | |
69 | - if($params === null) |
|
69 | + if ($params === null) |
|
70 | 70 | { |
71 | 71 | return null; |
72 | 72 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | $contentID = $info->getTokenByIndex(0); |
92 | 92 | |
93 | - if($contentID instanceof Mailcode_Parser_Statement_Tokenizer_Token_Number) |
|
93 | + if ($contentID instanceof Mailcode_Parser_Statement_Tokenizer_Token_Number) |
|
94 | 94 | { |
95 | 95 | $info->removeToken($contentID); |
96 | 96 | return $copy; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function getSyntaxName() : string |
113 | 113 | { |
114 | - if(isset($this->langToken)) |
|
114 | + if (isset($this->langToken)) |
|
115 | 115 | { |
116 | 116 | return $this->langToken->getText(); |
117 | 117 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | ->getInfo() |
135 | 135 | ->getStringLiteralByIndex(1); |
136 | 136 | |
137 | - if($lang) |
|
137 | + if ($lang) |
|
138 | 138 | { |
139 | 139 | $this->langToken = $lang; |
140 | 140 | return; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | { |
159 | 159 | // To keep PHPStan happy. If no token has been found, this |
160 | 160 | // method will not be called. |
161 | - if(!isset($this->langToken)) |
|
161 | + if (!isset($this->langToken)) |
|
162 | 162 | { |
163 | 163 | return; |
164 | 164 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $name = $this->langToken->getText(); |
167 | 167 | $supported = self::getSupportedSyntaxes(); |
168 | 168 | |
169 | - if(in_array($name, $supported)) |
|
169 | + if (in_array($name, $supported)) |
|
170 | 170 | { |
171 | 171 | return; |
172 | 172 | } |
@@ -84,15 +84,15 @@ discard block |
||
84 | 84 | { |
85 | 85 | $literals = $this->requireParams()->getInfo()->getStringLiterals(); |
86 | 86 | |
87 | - if(empty($literals)) { |
|
87 | + if (empty($literals)) { |
|
88 | 88 | return; |
89 | 89 | } |
90 | 90 | |
91 | - foreach($literals as $literal) |
|
91 | + foreach ($literals as $literal) |
|
92 | 92 | { |
93 | 93 | $parts = ConvertHelper::explodeTrim(' ', $literal->getText()); |
94 | 94 | |
95 | - foreach($parts as $part) { |
|
95 | + foreach ($parts as $part) { |
|
96 | 96 | $this->addClass($part); |
97 | 97 | } |
98 | 98 | } |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | { |
107 | 107 | $className = trim($className); |
108 | 108 | |
109 | - if($this->isClassNameValid($className)) |
|
109 | + if ($this->isClassNameValid($className)) |
|
110 | 110 | { |
111 | - if(!in_array($className, $this->classes, true)) { |
|
111 | + if (!in_array($className, $this->classes, true)) { |
|
112 | 112 | $this->classes[] = $className; |
113 | 113 | } |
114 | 114 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | public function preProcessOpening(): string |
142 | 142 | { |
143 | - if($this->isMultiline()) { |
|
143 | + if ($this->isMultiline()) { |
|
144 | 144 | return sprintf('<pre%s>', $this->renderAttributes()); |
145 | 145 | } |
146 | 146 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | public function preProcessClosing(): string |
151 | 151 | { |
152 | - if($this->isMultiline()) { |
|
152 | + if ($this->isMultiline()) { |
|
153 | 153 | return '</pre>'; |
154 | 154 | } |
155 | 155 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | private function renderAttributes() : string |
160 | 160 | { |
161 | - if(empty($this->classes)) { |
|
161 | + if (empty($this->classes)) { |
|
162 | 162 | return ''; |
163 | 163 | } |
164 | 164 |
@@ -33,19 +33,19 @@ |
||
33 | 33 | public const VALIDATION_VARIABLE_NAME_WITH_DOT = 49704; |
34 | 34 | public const VALIDATION_LOOP_VARIABLE_NAME_WITH_DOT = 49705; |
35 | 35 | |
36 | - /** |
|
37 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
38 | - */ |
|
36 | + /** |
|
37 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
38 | + */ |
|
39 | 39 | private ?Mailcode_Parser_Statement_Tokenizer_Token_Variable $loopVar = null; |
40 | 40 | |
41 | - /** |
|
42 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
43 | - */ |
|
41 | + /** |
|
42 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
43 | + */ |
|
44 | 44 | private ?Mailcode_Parser_Statement_Tokenizer_Token_Variable $sourceVar = null; |
45 | 45 | |
46 | - /** |
|
47 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL |
|
48 | - */ |
|
46 | + /** |
|
47 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL |
|
48 | + */ |
|
49 | 49 | private ?Mailcode_Parser_Statement_Tokenizer_Token_Keyword $keyword = null; |
50 | 50 | |
51 | 51 | public function getName() : string |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | public function getSourceVariable() : Mailcode_Variables_Variable |
103 | 103 | { |
104 | - if(isset($this->sourceVar)) |
|
104 | + if (isset($this->sourceVar)) |
|
105 | 105 | { |
106 | 106 | return $this->sourceVar->getVariable(); |
107 | 107 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | public function getLoopVariable() : Mailcode_Variables_Variable |
117 | 117 | { |
118 | - if(isset($this->loopVar)) |
|
118 | + if (isset($this->loopVar)) |
|
119 | 119 | { |
120 | 120 | return $this->loopVar->getVariable(); |
121 | 121 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $this->keyword = $info->getKeywordByIndex(1); |
136 | 136 | $this->sourceVar = $info->getVariableByIndex(2); |
137 | 137 | |
138 | - if(!$this->loopVar || !$this->keyword || !$this->sourceVar) |
|
138 | + if (!$this->loopVar || !$this->keyword || !$this->sourceVar) |
|
139 | 139 | { |
140 | 140 | $this->validationResult->makeError( |
141 | 141 | t('Not a valid for loop.').' '.t('Is the %1$s keyword missing?', 'in:'), |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | { |
151 | 151 | $keyword = $this->getInKeyword(); |
152 | 152 | |
153 | - if($keyword->isForIn()) |
|
153 | + if ($keyword->isForIn()) |
|
154 | 154 | { |
155 | 155 | return; |
156 | 156 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | protected function validateSyntax_variable_names() : void |
165 | 165 | { |
166 | - if($this->getSourceVariable()->getFullName() !== $this->getLoopVariable()->getFullName()) |
|
166 | + if ($this->getSourceVariable()->getFullName() !== $this->getLoopVariable()->getFullName()) |
|
167 | 167 | { |
168 | 168 | return; |
169 | 169 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | |
181 | 181 | $parts = explode('.', $name); |
182 | 182 | |
183 | - if(count($parts) === 1) { |
|
183 | + if (count($parts) === 1) { |
|
184 | 184 | return; |
185 | 185 | } |
186 | 186 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | |
198 | 198 | $parts = explode('.', $name); |
199 | 199 | |
200 | - if(count($parts) === 1) { |
|
200 | + if (count($parts) === 1) { |
|
201 | 201 | return; |
202 | 202 | } |
203 | 203 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | public function getInKeyword() : Mailcode_Parser_Statement_Tokenizer_Token_Keyword |
216 | 216 | { |
217 | - if(isset($this->keyword)) |
|
217 | + if (isset($this->keyword)) |
|
218 | 218 | { |
219 | 219 | return $this->keyword; |
220 | 220 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | { |
73 | 73 | $val = $this->validator->createStringLiteral(); |
74 | 74 | |
75 | - if($val->isValid()) |
|
75 | + if ($val->isValid()) |
|
76 | 76 | { |
77 | 77 | $this->sourceFormat = strtoupper($val->getToken()->getText()); |
78 | 78 | return; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | { |
95 | 95 | $countries = self::getSupportedCountries(); |
96 | 96 | |
97 | - if(isset($countries[$this->sourceFormat])) { |
|
97 | + if (isset($countries[$this->sourceFormat])) { |
|
98 | 98 | return; |
99 | 99 | } |
100 | 100 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public static function getSupportedCountries() : array |
115 | 115 | { |
116 | - if(self::$countriesLoaded) { |
|
116 | + if (self::$countriesLoaded) { |
|
117 | 117 | return self::$supportedCountries; |
118 | 118 | } |
119 | 119 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | $data = self::loadData(); |
123 | 123 | |
124 | - foreach($data as $code => $def) |
|
124 | + foreach ($data as $code => $def) |
|
125 | 125 | { |
126 | 126 | $code = (string)$code; |
127 | 127 | |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | $data = FileHelper::parseJSONFile(__DIR__.'/ShowPhone/numbers.json'); |
146 | 146 | $result = array(); |
147 | 147 | |
148 | - foreach($data as $idx => $def) |
|
148 | + foreach ($data as $idx => $def) |
|
149 | 149 | { |
150 | - if(!is_array($def) || !is_string($idx)) |
|
150 | + if (!is_array($def) || !is_string($idx)) |
|
151 | 151 | { |
152 | 152 | continue; |
153 | 153 | } |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | public const ERROR_CANNOT_MODIFY_FINALIZED = 52302; |
27 | 27 | public const ERROR_NO_VALIDATION_RESULT_AVAILABLE = 52303; |
28 | 28 | |
29 | - /** |
|
30 | - * @var Mailcode_Commands_Command[] |
|
31 | - */ |
|
29 | + /** |
|
30 | + * @var Mailcode_Commands_Command[] |
|
31 | + */ |
|
32 | 32 | protected array $commands = array(); |
33 | 33 | |
34 | 34 | /** |
@@ -63,21 +63,21 @@ discard block |
||
63 | 63 | return $this; |
64 | 64 | } |
65 | 65 | |
66 | - /** |
|
67 | - * Whether there are any commands in the collection. |
|
68 | - * |
|
69 | - * @return bool |
|
70 | - */ |
|
66 | + /** |
|
67 | + * Whether there are any commands in the collection. |
|
68 | + * |
|
69 | + * @return bool |
|
70 | + */ |
|
71 | 71 | public function hasCommands() : bool |
72 | 72 | { |
73 | 73 | return !empty($this->commands); |
74 | 74 | } |
75 | 75 | |
76 | - /** |
|
77 | - * Counts the amount of commands in the collection. |
|
78 | - * |
|
79 | - * @return int |
|
80 | - */ |
|
76 | + /** |
|
77 | + * Counts the amount of commands in the collection. |
|
78 | + * |
|
79 | + * @return int |
|
80 | + */ |
|
81 | 81 | public function countCommands() : int |
82 | 82 | { |
83 | 83 | return count($this->commands); |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | $this->commands = $keep; |
99 | 99 | } |
100 | 100 | |
101 | - /** |
|
102 | - * Retrieves all commands that were detected, in the exact order |
|
103 | - * they were found. |
|
104 | - * |
|
105 | - * @return Mailcode_Commands_Command[] |
|
106 | - */ |
|
101 | + /** |
|
102 | + * Retrieves all commands that were detected, in the exact order |
|
103 | + * they were found. |
|
104 | + * |
|
105 | + * @return Mailcode_Commands_Command[] |
|
106 | + */ |
|
107 | 107 | public function getCommands() : array |
108 | 108 | { |
109 | 109 | $this->validate(); |
@@ -357,10 +357,10 @@ discard block |
||
357 | 357 | } |
358 | 358 | |
359 | 359 | /** |
360 | - * Retrieves only show variable commands in the collection, if any. |
|
361 | - * |
|
362 | - * @return Mailcode_Commands_Command_ShowVariable[] |
|
363 | - */ |
|
360 | + * Retrieves only show variable commands in the collection, if any. |
|
361 | + * |
|
362 | + * @return Mailcode_Commands_Command_ShowVariable[] |
|
363 | + */ |
|
364 | 364 | public function getShowVariableCommands(): array |
365 | 365 | { |
366 | 366 | return Mailcode_Collection_TypeFilter::getShowVariableCommands($this->commands); |
@@ -374,11 +374,11 @@ discard block |
||
374 | 374 | return Mailcode_Collection_TypeFilter::getForCommands($this->commands); |
375 | 375 | } |
376 | 376 | |
377 | - /** |
|
378 | - * Retrieves only show date commands in the collection, if any. |
|
379 | - * |
|
380 | - * @return Mailcode_Commands_Command_ShowDate[] |
|
381 | - */ |
|
377 | + /** |
|
378 | + * Retrieves only show date commands in the collection, if any. |
|
379 | + * |
|
380 | + * @return Mailcode_Commands_Command_ShowDate[] |
|
381 | + */ |
|
382 | 382 | public function getShowDateCommands() : array |
383 | 383 | { |
384 | 384 | return Mailcode_Collection_TypeFilter::getShowDateCommands($this->commands); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function addCommand(Mailcode_Commands_Command $command) : Mailcode_Collection |
47 | 47 | { |
48 | - if($this->finalized) |
|
48 | + if ($this->finalized) |
|
49 | 49 | { |
50 | 50 | throw new Mailcode_Exception( |
51 | 51 | 'Cannot add commands to a finalized collection', |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | { |
88 | 88 | $keep = array(); |
89 | 89 | |
90 | - foreach($this->commands as $existing) |
|
90 | + foreach ($this->commands as $existing) |
|
91 | 91 | { |
92 | - if($existing !== $command) |
|
92 | + if ($existing !== $command) |
|
93 | 93 | { |
94 | 94 | $keep[] = $existing; |
95 | 95 | } |
@@ -126,11 +126,11 @@ discard block |
||
126 | 126 | |
127 | 127 | $hashes = array(); |
128 | 128 | |
129 | - foreach($this->commands as $command) |
|
129 | + foreach ($this->commands as $command) |
|
130 | 130 | { |
131 | 131 | $hash = $command->getHash(); |
132 | 132 | |
133 | - if(!isset($hashes[$hash])) |
|
133 | + if (!isset($hashes[$hash])) |
|
134 | 134 | { |
135 | 135 | $hashes[$hash] = $command; |
136 | 136 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function addCommands(array $commands) : Mailcode_Collection |
150 | 150 | { |
151 | - foreach($commands as $command) |
|
151 | + foreach ($commands as $command) |
|
152 | 152 | { |
153 | 153 | $this->addCommand($command); |
154 | 154 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | $collection = new Mailcode_Variables_Collection_Regular(); |
173 | 173 | |
174 | - foreach($this->commands as $command) |
|
174 | + foreach ($this->commands as $command) |
|
175 | 175 | { |
176 | 176 | $collection->mergeWith($command->getVariables()); |
177 | 177 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | { |
212 | 212 | $this->validate(); |
213 | 213 | |
214 | - if(isset($this->validationResult)) |
|
214 | + if (isset($this->validationResult)) |
|
215 | 215 | { |
216 | 216 | return $this->validationResult; |
217 | 217 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | |
226 | 226 | private function validate() : void |
227 | 227 | { |
228 | - if(isset($this->validationResult) || $this->validating) |
|
228 | + if (isset($this->validationResult) || $this->validating) |
|
229 | 229 | { |
230 | 230 | return; |
231 | 231 | } |
@@ -245,9 +245,9 @@ discard block |
||
245 | 245 | { |
246 | 246 | $errors = $this->getErrors(); |
247 | 247 | |
248 | - foreach($errors as $error) |
|
248 | + foreach ($errors as $error) |
|
249 | 249 | { |
250 | - if($error->getCode() === $code) |
|
250 | + if ($error->getCode() === $code) |
|
251 | 251 | { |
252 | 252 | return true; |
253 | 253 | } |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | |
283 | 283 | $errors = $this->errors; |
284 | 284 | |
285 | - if(!$result->isValid()) |
|
285 | + if (!$result->isValid()) |
|
286 | 286 | { |
287 | 287 | $errors[] = new Mailcode_Collection_Error_Message( |
288 | 288 | '', |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | { |
299 | 299 | $errors = $this->getErrors(); |
300 | 300 | |
301 | - if(!empty($errors)) |
|
301 | + if (!empty($errors)) |
|
302 | 302 | { |
303 | 303 | return array_shift($errors); |
304 | 304 | } |
@@ -319,11 +319,11 @@ discard block |
||
319 | 319 | |
320 | 320 | private function validateNesting() : void |
321 | 321 | { |
322 | - foreach($this->commands as $command) |
|
322 | + foreach ($this->commands as $command) |
|
323 | 323 | { |
324 | 324 | $command->validateNesting(); |
325 | 325 | |
326 | - if(!$command->isValid()) { |
|
326 | + if (!$command->isValid()) { |
|
327 | 327 | $this->addInvalidCommand($command); |
328 | 328 | } |
329 | 329 | } |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | { |
401 | 401 | $commands = $this->getCommands(); |
402 | 402 | |
403 | - if(!empty($commands)) |
|
403 | + if (!empty($commands)) |
|
404 | 404 | { |
405 | 405 | return array_shift($commands); |
406 | 406 | } |
@@ -432,16 +432,16 @@ discard block |
||
432 | 432 | */ |
433 | 433 | private function pruneProtectedContentCommands() : void |
434 | 434 | { |
435 | - if(!$this->isValid()) |
|
435 | + if (!$this->isValid()) |
|
436 | 436 | { |
437 | 437 | return; |
438 | 438 | } |
439 | 439 | |
440 | 440 | $keep = array(); |
441 | 441 | |
442 | - foreach($this->commands as $command) |
|
442 | + foreach ($this->commands as $command) |
|
443 | 443 | { |
444 | - if(!$command->hasContentParent()) |
|
444 | + if (!$command->hasContentParent()) |
|
445 | 445 | { |
446 | 446 | $keep[] = $command; |
447 | 447 | } |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | $errors = $this->getErrors(); |
459 | 459 | $result = array(); |
460 | 460 | |
461 | - foreach($errors as $error) |
|
461 | + foreach ($errors as $error) |
|
462 | 462 | { |
463 | 463 | $result[] = $error->getCode(); |
464 | 464 | } |
@@ -8,7 +8,7 @@ |
||
8 | 8 | { |
9 | 9 | public const VALIDATION_NAME_NOHTML = 'nohtml'; |
10 | 10 | |
11 | - public function setHTMLEnabled(bool $enabled=true) : self; |
|
11 | + public function setHTMLEnabled(bool $enabled = true) : self; |
|
12 | 12 | |
13 | 13 | public function isHTMLEnabled() : bool; |
14 | 14 |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | { |
49 | 49 | $instanceID = $command->getInstanceID(); |
50 | 50 | |
51 | - if(isset(self::$generated[$instanceID])) |
|
51 | + if (isset(self::$generated[$instanceID])) |
|
52 | 52 | { |
53 | 53 | return self::$generated[$instanceID]; |
54 | 54 | } |
@@ -85,11 +85,11 @@ discard block |
||
85 | 85 | |
86 | 86 | private static function generateIDString(TrackingIDInterface $command) : string |
87 | 87 | { |
88 | - if(isset(self::$customGenerator)) |
|
88 | + if (isset(self::$customGenerator)) |
|
89 | 89 | { |
90 | 90 | $result = call_user_func(self::$customGenerator, $command); |
91 | 91 | |
92 | - if(is_string($result)) |
|
92 | + if (is_string($result)) |
|
93 | 93 | { |
94 | 94 | return $result; |
95 | 95 | } |