@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | $this->replaces = array(); |
60 | 60 | |
61 | - foreach($placeholders as $placeholder) |
|
61 | + foreach ($placeholders as $placeholder) |
|
62 | 62 | { |
63 | 63 | $this->processPlaceholder($placeholder); |
64 | 64 | } |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | $replace = ''; |
72 | 72 | $needle = $placeholder->getReplacementText(); |
73 | 73 | |
74 | - if($this->highlighted) |
|
74 | + if ($this->highlighted) |
|
75 | 75 | { |
76 | 76 | $replace = $this->processPlaceholder_highlighted($placeholder, $needle); |
77 | 77 | } |
78 | - else if($this->normalize) |
|
78 | + else if ($this->normalize) |
|
79 | 79 | { |
80 | 80 | $replace = $placeholder->getNormalizedText(); |
81 | 81 | } |
@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | { |
92 | 92 | $formatter = $this->safeguard->getFormatter(); |
93 | 93 | |
94 | - if(!$formatter) |
|
94 | + if (!$formatter) |
|
95 | 95 | { |
96 | 96 | return $placeholder->getHighlightedText(); |
97 | 97 | } |
98 | 98 | |
99 | 99 | $formattedNeedle = $formatter->getReplaceNeedle($placeholder); |
100 | 100 | |
101 | - if($formattedNeedle !== $needle) |
|
101 | + if ($formattedNeedle !== $needle) |
|
102 | 102 | { |
103 | 103 | $this->replaces[$formattedNeedle] = $placeholder->getHighlightedText(); |
104 | 104 |
@@ -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', |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $safe = str_replace(array_values($replaces), array_keys($replaces), $this->originalString); |
187 | 187 | |
188 | 188 | // If a formatter has been selected, let it modify the string. |
189 | - if(isset($this->formatter)) |
|
189 | + if (isset($this->formatter)) |
|
190 | 190 | { |
191 | 191 | $safe = $this->formatter->format($safe); |
192 | 192 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | { |
204 | 204 | $class = 'Mailcode\Mailcode_Parser_Safeguard_Formatter_'.$formatterID; |
205 | 205 | |
206 | - if(class_exists($class)) |
|
206 | + if (class_exists($class)) |
|
207 | 207 | { |
208 | 208 | $this->formatter = new $class($this); |
209 | 209 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | { |
226 | 226 | $formatter = $this->selectFormatter('HTMLHighlighting'); |
227 | 227 | |
228 | - if($formatter instanceof Mailcode_Parser_Safeguard_Formatter_HTMLHighlighting) |
|
228 | + if ($formatter instanceof Mailcode_Parser_Safeguard_Formatter_HTMLHighlighting) |
|
229 | 229 | { |
230 | 230 | return $formatter; |
231 | 231 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | { |
242 | 242 | $formatter = $this->selectFormatter('SingleLines'); |
243 | 243 | |
244 | - if($formatter instanceof Mailcode_Parser_Safeguard_Formatter_SingleLines) |
|
244 | + if ($formatter instanceof Mailcode_Parser_Safeguard_Formatter_SingleLines) |
|
245 | 245 | { |
246 | 246 | return $formatter; |
247 | 247 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * @param bool $highlighted |
269 | 269 | * @return string[]string |
270 | 270 | */ |
271 | - protected function getReplaces(bool $highlighted=false, bool $normalize=false) : array |
|
271 | + protected function getReplaces(bool $highlighted = false, bool $normalize = false) : array |
|
272 | 272 | { |
273 | 273 | $restorer = new Mailcode_Parser_Safeguard_Restorer($this, $highlighted, $normalize); |
274 | 274 | return $restorer->getReplaces(); |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | */ |
283 | 283 | public function getPlaceholders() |
284 | 284 | { |
285 | - if(isset($this->placeholders)) |
|
285 | + if (isset($this->placeholders)) |
|
286 | 286 | { |
287 | 287 | return $this->placeholders; |
288 | 288 | } |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | |
292 | 292 | $cmds = $this->getCollection()->getGroupedByHash(); |
293 | 293 | |
294 | - foreach($cmds as $command) |
|
294 | + foreach ($cmds as $command) |
|
295 | 295 | { |
296 | 296 | self::$counter++; |
297 | 297 | |
@@ -305,9 +305,9 @@ discard block |
||
305 | 305 | return $this->placeholders; |
306 | 306 | } |
307 | 307 | |
308 | - protected function restore(string $string, bool $partial=false, bool $highlighted=false) : string |
|
308 | + protected function restore(string $string, bool $partial = false, bool $highlighted = false) : string |
|
309 | 309 | { |
310 | - if(!$partial) |
|
310 | + if (!$partial) |
|
311 | 311 | { |
312 | 312 | $this->requireValidCollection(); |
313 | 313 | } |
@@ -316,9 +316,9 @@ discard block |
||
316 | 316 | |
317 | 317 | $placeholderStrings = array_keys($replaces); |
318 | 318 | |
319 | - foreach($placeholderStrings as $search) |
|
319 | + foreach ($placeholderStrings as $search) |
|
320 | 320 | { |
321 | - if(!$partial && !$highlighted && !strstr($string, $search)) |
|
321 | + if (!$partial && !$highlighted && !strstr($string, $search)) |
|
322 | 322 | { |
323 | 323 | throw new Mailcode_Exception( |
324 | 324 | 'Command placeholder not found', |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | */ |
421 | 421 | public function getCollection() : Mailcode_Collection |
422 | 422 | { |
423 | - if(isset($this->collection)) |
|
423 | + if (isset($this->collection)) |
|
424 | 424 | { |
425 | 425 | return $this->collection; |
426 | 426 | } |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | */ |
443 | 443 | protected function requireValidCollection() : void |
444 | 444 | { |
445 | - if($this->getCollection()->isValid()) |
|
445 | + if ($this->getCollection()->isValid()) |
|
446 | 446 | { |
447 | 447 | return; |
448 | 448 | } |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | */ |
466 | 466 | public function getPlaceholderStrings() : array |
467 | 467 | { |
468 | - if(is_array($this->placeholderStrings)) |
|
468 | + if (is_array($this->placeholderStrings)) |
|
469 | 469 | { |
470 | 470 | return $this->placeholderStrings; |
471 | 471 | } |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | |
475 | 475 | $this->placeholderStrings = array(); |
476 | 476 | |
477 | - foreach($placeholders as $placeholder) |
|
477 | + foreach ($placeholders as $placeholder) |
|
478 | 478 | { |
479 | 479 | $this->placeholderStrings[] = $placeholder->getReplacementText(); |
480 | 480 | } |
@@ -500,9 +500,9 @@ discard block |
||
500 | 500 | { |
501 | 501 | $placeholders = $this->getPlaceholders(); |
502 | 502 | |
503 | - foreach($placeholders as $placeholder) |
|
503 | + foreach ($placeholders as $placeholder) |
|
504 | 504 | { |
505 | - if($placeholder->getID() === $id) |
|
505 | + if ($placeholder->getID() === $id) |
|
506 | 506 | { |
507 | 507 | return $placeholder; |
508 | 508 | } |
@@ -529,9 +529,9 @@ discard block |
||
529 | 529 | { |
530 | 530 | $placeholders = $this->getPlaceholders(); |
531 | 531 | |
532 | - foreach($placeholders as $placeholder) |
|
532 | + foreach ($placeholders as $placeholder) |
|
533 | 533 | { |
534 | - if($placeholder->getReplacementText() === $string) |
|
534 | + if ($placeholder->getReplacementText() === $string) |
|
535 | 535 | { |
536 | 536 | return $placeholder; |
537 | 537 | } |