@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | $errors = $this->errors; |
101 | 101 | |
102 | - if(!$result->isValid()) |
|
102 | + if (!$result->isValid()) |
|
103 | 103 | { |
104 | 104 | $errors[] = new Mailcode_Collection_Error_Message( |
105 | 105 | '', |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | { |
116 | 116 | $errors = $this->getErrors(); |
117 | 117 | |
118 | - if(!empty($errors)) |
|
118 | + if (!empty($errors)) |
|
119 | 119 | { |
120 | 120 | return array_shift($errors); |
121 | 121 | } |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | { |
158 | 158 | $hashes = array(); |
159 | 159 | |
160 | - foreach($this->commands as $command) |
|
160 | + foreach ($this->commands as $command) |
|
161 | 161 | { |
162 | 162 | $hash = $command->getHash(); |
163 | 163 | |
164 | - if(!isset($hashes[$hash])) |
|
164 | + if (!isset($hashes[$hash])) |
|
165 | 165 | { |
166 | 166 | $hashes[$hash] = $command; |
167 | 167 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function addCommands(array $commands) : Mailcode_Collection |
180 | 180 | { |
181 | - foreach($commands as $command) |
|
181 | + foreach ($commands as $command) |
|
182 | 182 | { |
183 | 183 | $this->addCommand($command); |
184 | 184 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | { |
198 | 198 | $collection = new Mailcode_Variables_Collection_Regular(); |
199 | 199 | |
200 | - foreach($this->commands as $command) |
|
200 | + foreach ($this->commands as $command) |
|
201 | 201 | { |
202 | 202 | $collection->mergeWith($command->getVariables()); |
203 | 203 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | |
208 | 208 | public function getValidationResult() : OperationResult |
209 | 209 | { |
210 | - if($this->validationResult instanceof OperationResult) |
|
210 | + if ($this->validationResult instanceof OperationResult) |
|
211 | 211 | { |
212 | 212 | return $this->validationResult; |
213 | 213 | } |
@@ -223,9 +223,9 @@ discard block |
||
223 | 223 | { |
224 | 224 | $errors = $this->getErrors(); |
225 | 225 | |
226 | - foreach($errors as $error) |
|
226 | + foreach ($errors as $error) |
|
227 | 227 | { |
228 | - if($error->getCode() === $code) |
|
228 | + if ($error->getCode() === $code) |
|
229 | 229 | { |
230 | 230 | return true; |
231 | 231 | } |
@@ -243,9 +243,9 @@ discard block |
||
243 | 243 | { |
244 | 244 | $result = array(); |
245 | 245 | |
246 | - foreach($this->commands as $command) |
|
246 | + foreach ($this->commands as $command) |
|
247 | 247 | { |
248 | - if($command instanceof Mailcode_Commands_Command_ShowVariable) |
|
248 | + if ($command instanceof Mailcode_Commands_Command_ShowVariable) |
|
249 | 249 | { |
250 | 250 | $result[] = $command; |
251 | 251 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | { |
259 | 259 | $commands = $this->getCommands(); |
260 | 260 | |
261 | - if(!empty($commands)) |
|
261 | + if (!empty($commands)) |
|
262 | 262 | { |
263 | 263 | return array_shift($commands); |
264 | 264 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function setDelimiter(string $delimiter) : Mailcode_Parser_Safeguard |
136 | 136 | { |
137 | - if(empty($delimiter)) |
|
137 | + if (empty($delimiter)) |
|
138 | 138 | { |
139 | 139 | throw new Mailcode_Exception( |
140 | 140 | 'Empty delimiter', |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $safe = str_replace(array_values($replaces), array_keys($replaces), $this->originalString); |
172 | 172 | |
173 | 173 | // If a formatter has been selected, let it modify the string. |
174 | - if(isset($this->formatter)) |
|
174 | + if (isset($this->formatter)) |
|
175 | 175 | { |
176 | 176 | $safe = $this->formatter->format($safe); |
177 | 177 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | { |
184 | 184 | $class = 'Mailcode\Mailcode_Parser_Safeguard_Formatter_'.$formatterID; |
185 | 185 | |
186 | - if(class_exists($class)) |
|
186 | + if (class_exists($class)) |
|
187 | 187 | { |
188 | 188 | $this->formatter = new $class($this); |
189 | 189 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | { |
210 | 210 | $formatter = $this->selectFormatter('SingleLines'); |
211 | 211 | |
212 | - if($formatter instanceof Mailcode_Parser_Safeguard_Formatter_SingleLines) |
|
212 | + if ($formatter instanceof Mailcode_Parser_Safeguard_Formatter_SingleLines) |
|
213 | 213 | { |
214 | 214 | return $formatter; |
215 | 215 | } |
@@ -231,17 +231,17 @@ discard block |
||
231 | 231 | * @param bool $highlighted |
232 | 232 | * @return string[]string |
233 | 233 | */ |
234 | - protected function getReplaces(bool $highlighted=false) : array |
|
234 | + protected function getReplaces(bool $highlighted = false) : array |
|
235 | 235 | { |
236 | 236 | $placeholders = $this->getPlaceholders(); |
237 | 237 | |
238 | 238 | $replaces = array(); |
239 | 239 | |
240 | - foreach($placeholders as $placeholder) |
|
240 | + foreach ($placeholders as $placeholder) |
|
241 | 241 | { |
242 | 242 | $replace = ''; |
243 | 243 | |
244 | - if($highlighted) |
|
244 | + if ($highlighted) |
|
245 | 245 | { |
246 | 246 | $replace = $placeholder->getHighlightedText(); |
247 | 247 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | */ |
266 | 266 | public function getPlaceholders() |
267 | 267 | { |
268 | - if(isset($this->placeholders)) |
|
268 | + if (isset($this->placeholders)) |
|
269 | 269 | { |
270 | 270 | return $this->placeholders; |
271 | 271 | } |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | |
275 | 275 | $cmds = $this->getCollection()->getGroupedByHash(); |
276 | 276 | |
277 | - foreach($cmds as $command) |
|
277 | + foreach ($cmds as $command) |
|
278 | 278 | { |
279 | 279 | self::$counter++; |
280 | 280 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | return $this->placeholders; |
289 | 289 | } |
290 | 290 | |
291 | - protected function restore(string $string, bool $partial=false, bool $highlighted=false) : string |
|
291 | + protected function restore(string $string, bool $partial = false, bool $highlighted = false) : string |
|
292 | 292 | { |
293 | 293 | $this->requireValidCollection(); |
294 | 294 | |
@@ -296,9 +296,9 @@ discard block |
||
296 | 296 | |
297 | 297 | $placeholderStrings = array_keys($replaces); |
298 | 298 | |
299 | - foreach($placeholderStrings as $search) |
|
299 | + foreach ($placeholderStrings as $search) |
|
300 | 300 | { |
301 | - if(!$partial && !strstr($string, $search)) |
|
301 | + if (!$partial && !strstr($string, $search)) |
|
302 | 302 | { |
303 | 303 | throw new Mailcode_Exception( |
304 | 304 | 'Command placeholder not found', |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | */ |
401 | 401 | public function getCollection() : Mailcode_Collection |
402 | 402 | { |
403 | - if(isset($this->collection)) |
|
403 | + if (isset($this->collection)) |
|
404 | 404 | { |
405 | 405 | return $this->collection; |
406 | 406 | } |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | */ |
423 | 423 | protected function requireValidCollection() : void |
424 | 424 | { |
425 | - if($this->getCollection()->isValid()) |
|
425 | + if ($this->getCollection()->isValid()) |
|
426 | 426 | { |
427 | 427 | return; |
428 | 428 | } |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | */ |
446 | 446 | public function getPlaceholderStrings() : array |
447 | 447 | { |
448 | - if(is_array($this->placeholderStrings)) |
|
448 | + if (is_array($this->placeholderStrings)) |
|
449 | 449 | { |
450 | 450 | return $this->placeholderStrings; |
451 | 451 | } |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | |
455 | 455 | $this->placeholderStrings = array(); |
456 | 456 | |
457 | - foreach($placeholders as $placeholder) |
|
457 | + foreach ($placeholders as $placeholder) |
|
458 | 458 | { |
459 | 459 | $this->placeholderStrings[] = $placeholder->getReplacementText(); |
460 | 460 | } |
@@ -480,9 +480,9 @@ discard block |
||
480 | 480 | { |
481 | 481 | $placeholders = $this->getPlaceholders(); |
482 | 482 | |
483 | - foreach($placeholders as $placeholder) |
|
483 | + foreach ($placeholders as $placeholder) |
|
484 | 484 | { |
485 | - if($placeholder->getID() === $id) |
|
485 | + if ($placeholder->getID() === $id) |
|
486 | 486 | { |
487 | 487 | return $placeholder; |
488 | 488 | } |
@@ -509,9 +509,9 @@ discard block |
||
509 | 509 | { |
510 | 510 | $placeholders = $this->getPlaceholders(); |
511 | 511 | |
512 | - foreach($placeholders as $placeholder) |
|
512 | + foreach ($placeholders as $placeholder) |
|
513 | 513 | { |
514 | - if($placeholder->getReplacementText() === $string) |
|
514 | + if ($placeholder->getReplacementText() === $string) |
|
515 | 515 | { |
516 | 516 | return $placeholder; |
517 | 517 | } |