@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function setDelimiter(string $delimiter) : Mailcode_Parser_Safeguard |
128 | 128 | { |
129 | - if(empty($delimiter)) |
|
129 | + if (empty($delimiter)) |
|
130 | 130 | { |
131 | 131 | throw new Mailcode_Exception( |
132 | 132 | 'Empty delimiter', |
@@ -176,11 +176,11 @@ discard block |
||
176 | 176 | $placeholders = $this->getPlaceholders(); |
177 | 177 | $string = $this->originalString; |
178 | 178 | |
179 | - foreach($placeholders as $placeholder) |
|
179 | + foreach ($placeholders as $placeholder) |
|
180 | 180 | { |
181 | 181 | $pos = mb_strpos($string, $placeholder->getOriginalText()); |
182 | 182 | |
183 | - if($pos === false) |
|
183 | + if ($pos === false) |
|
184 | 184 | { |
185 | 185 | throw new Mailcode_Exception( |
186 | 186 | 'Placeholder original text not found', |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function createFormatting($subject) : Mailcode_Parser_Safeguard_Formatting |
211 | 211 | { |
212 | - if(is_string($subject)) |
|
212 | + if (is_string($subject)) |
|
213 | 213 | { |
214 | 214 | $subject = Mailcode::create()->createString($subject); |
215 | 215 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function getPlaceholders() |
227 | 227 | { |
228 | - if(isset($this->placeholders)) |
|
228 | + if (isset($this->placeholders)) |
|
229 | 229 | { |
230 | 230 | return $this->placeholders; |
231 | 231 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | |
235 | 235 | $cmds = $this->getCollection()->getCommands(); |
236 | 236 | |
237 | - foreach($cmds as $command) |
|
237 | + foreach ($cmds as $command) |
|
238 | 238 | { |
239 | 239 | self::$counter++; |
240 | 240 | |
@@ -248,16 +248,16 @@ discard block |
||
248 | 248 | return $this->placeholders; |
249 | 249 | } |
250 | 250 | |
251 | - protected function restore(string $string, bool $partial=false, bool $highlighted=false) : string |
|
251 | + protected function restore(string $string, bool $partial = false, bool $highlighted = false) : string |
|
252 | 252 | { |
253 | - if(!$partial) |
|
253 | + if (!$partial) |
|
254 | 254 | { |
255 | 255 | $this->requireValidCollection(); |
256 | 256 | } |
257 | 257 | |
258 | 258 | $formatting = $this->createFormatting($string); |
259 | 259 | |
260 | - if($highlighted) |
|
260 | + if ($highlighted) |
|
261 | 261 | { |
262 | 262 | $formatting->replaceWithHTMLHighlighting(); |
263 | 263 | } |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | */ |
354 | 354 | public function getCollection() : Mailcode_Collection |
355 | 355 | { |
356 | - if(isset($this->collection)) |
|
356 | + if (isset($this->collection)) |
|
357 | 357 | { |
358 | 358 | return $this->collection; |
359 | 359 | } |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | */ |
376 | 376 | protected function requireValidCollection() : void |
377 | 377 | { |
378 | - if($this->getCollection()->isValid()) |
|
378 | + if ($this->getCollection()->isValid()) |
|
379 | 379 | { |
380 | 380 | return; |
381 | 381 | } |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | */ |
399 | 399 | public function getPlaceholderStrings() : array |
400 | 400 | { |
401 | - if(is_array($this->placeholderStrings)) |
|
401 | + if (is_array($this->placeholderStrings)) |
|
402 | 402 | { |
403 | 403 | return $this->placeholderStrings; |
404 | 404 | } |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | |
408 | 408 | $this->placeholderStrings = array(); |
409 | 409 | |
410 | - foreach($placeholders as $placeholder) |
|
410 | + foreach ($placeholders as $placeholder) |
|
411 | 411 | { |
412 | 412 | $this->placeholderStrings[] = $placeholder->getReplacementText(); |
413 | 413 | } |
@@ -433,9 +433,9 @@ discard block |
||
433 | 433 | { |
434 | 434 | $placeholders = $this->getPlaceholders(); |
435 | 435 | |
436 | - foreach($placeholders as $placeholder) |
|
436 | + foreach ($placeholders as $placeholder) |
|
437 | 437 | { |
438 | - if($placeholder->getID() === $id) |
|
438 | + if ($placeholder->getID() === $id) |
|
439 | 439 | { |
440 | 440 | return $placeholder; |
441 | 441 | } |
@@ -462,9 +462,9 @@ discard block |
||
462 | 462 | { |
463 | 463 | $placeholders = $this->getPlaceholders(); |
464 | 464 | |
465 | - foreach($placeholders as $placeholder) |
|
465 | + foreach ($placeholders as $placeholder) |
|
466 | 466 | { |
467 | - if($placeholder->getReplacementText() === $string) |
|
467 | + if ($placeholder->getReplacementText() === $string) |
|
468 | 468 | { |
469 | 469 | return $placeholder; |
470 | 470 | } |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | public function updateString(string $subject) : bool |
89 | 89 | { |
90 | 90 | // avoid triggering an update if there are no changes in the string |
91 | - if($subject === $this->subject) |
|
91 | + if ($subject === $this->subject) |
|
92 | 92 | { |
93 | 93 | return false; |
94 | 94 | } |
95 | 95 | |
96 | - if($this->updating) |
|
96 | + if ($this->updating) |
|
97 | 97 | { |
98 | 98 | throw new Mailcode_Exception( |
99 | 99 | 'Cannot modify subject string during update', |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $this->subject = $subject; |
108 | 108 | $this->length = mb_strlen($this->subject); |
109 | 109 | |
110 | - foreach($this->listeners as $listener) |
|
110 | + foreach ($this->listeners as $listener) |
|
111 | 111 | { |
112 | 112 | $listener($this); |
113 | 113 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | { |
143 | 143 | self::$listenerCounter++; |
144 | 144 | |
145 | - if(!is_callable($callback)) |
|
145 | + if (!is_callable($callback)) |
|
146 | 146 | { |
147 | 147 | throw new Mailcode_Exception( |
148 | 148 | 'Not a valid callable', |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function removeListener(int $listenerID) : void |
174 | 174 | { |
175 | - if(isset($this->listeners[$listenerID])) |
|
175 | + if (isset($this->listeners[$listenerID])) |
|
176 | 176 | { |
177 | 177 | unset($this->listeners[$listenerID]); |
178 | 178 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | return mb_strpos($this->subject, $needle); |
204 | 204 | } |
205 | 205 | |
206 | - public function getSubstr(int $start, ?int $length=null) : string |
|
206 | + public function getSubstr(int $start, ?int $length = null) : string |
|
207 | 207 | { |
208 | 208 | return mb_substr($this->subject, $start, $length); |
209 | 209 | } |