@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | $this->instantiator->checkCommand($cmd); |
36 | 36 | |
37 | - if($cmd instanceof Mailcode_Commands_Command_Comment) |
|
37 | + if ($cmd instanceof Mailcode_Commands_Command_Comment) |
|
38 | 38 | { |
39 | 39 | return $cmd; |
40 | 40 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | throw $this->instantiator->exceptionUnexpectedType('Comment', $cmd); |
43 | 43 | } |
44 | 44 | |
45 | - public function for(string $sourceVariable, string $loopVariable) : Mailcode_Commands_Command_For |
|
45 | + public function for (string $sourceVariable, string $loopVariable) : Mailcode_Commands_Command_For |
|
46 | 46 | { |
47 | 47 | $sourceVariable = '$'.ltrim($sourceVariable, '$'); |
48 | 48 | $loopVariable = '$'.ltrim($loopVariable, '$'); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | $this->instantiator->checkCommand($cmd); |
66 | 66 | |
67 | - if($cmd instanceof Mailcode_Commands_Command_For) |
|
67 | + if ($cmd instanceof Mailcode_Commands_Command_For) |
|
68 | 68 | { |
69 | 69 | return $cmd; |
70 | 70 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | public function getSourceVariable() : Mailcode_Variables_Variable |
90 | 90 | { |
91 | - if(isset($this->sourceVar)) |
|
91 | + if (isset($this->sourceVar)) |
|
92 | 92 | { |
93 | 93 | return $this->sourceVar->getVariable(); |
94 | 94 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | public function getLoopVariable() : Mailcode_Variables_Variable |
104 | 104 | { |
105 | - if(isset($this->loopVar)) |
|
105 | + if (isset($this->loopVar)) |
|
106 | 106 | { |
107 | 107 | return $this->loopVar->getVariable(); |
108 | 108 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $this->keyword = $info->getKeywordByIndex(1); |
123 | 123 | $this->sourceVar = $info->getVariableByIndex(2); |
124 | 124 | |
125 | - if(!$this->loopVar || !$this->keyword || !$this->sourceVar) |
|
125 | + if (!$this->loopVar || !$this->keyword || !$this->sourceVar) |
|
126 | 126 | { |
127 | 127 | $this->validationResult->makeError( |
128 | 128 | t('Not a valid for loop.').' '.t('Is the %1$s keyword missing?', 'in:'), |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | |
136 | 136 | protected function validateSyntax_keyword() : void |
137 | 137 | { |
138 | - if($this->keyword->isForIn()) |
|
138 | + if ($this->keyword->isForIn()) |
|
139 | 139 | { |
140 | 140 | return; |
141 | 141 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | protected function validateSyntax_variable_names() : void |
150 | 150 | { |
151 | - if($this->sourceVar->getVariable()->getFullName() !== $this->loopVar->getVariable()->getFullName()) |
|
151 | + if ($this->sourceVar->getVariable()->getFullName() !== $this->loopVar->getVariable()->getFullName()) |
|
152 | 152 | { |
153 | 153 | return; |
154 | 154 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @param string $formatString A date format string, or empty string for default. |
48 | 48 | * @return Mailcode_Commands_Command_ShowDate |
49 | 49 | */ |
50 | - public static function showDate(string $variableName, string $formatString="") : Mailcode_Commands_Command_ShowDate |
|
50 | + public static function showDate(string $variableName, string $formatString = "") : Mailcode_Commands_Command_ShowDate |
|
51 | 51 | { |
52 | 52 | return self::$commandSets->show()->showDate($variableName, $formatString); |
53 | 53 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @see Mailcode_Factory::ERROR_INVALID_COMMAND_CREATED |
76 | 76 | */ |
77 | - public static function setVar(string $variableName, string $value, bool $quoteValue=true) : Mailcode_Commands_Command_SetVariable |
|
77 | + public static function setVar(string $variableName, string $value, bool $quoteValue = true) : Mailcode_Commands_Command_SetVariable |
|
78 | 78 | { |
79 | 79 | return self::$commandSets->set()->setVar($variableName, $value, $quoteValue); |
80 | 80 | } |
@@ -107,12 +107,12 @@ discard block |
||
107 | 107 | return self::$commandSets->if()->end(); |
108 | 108 | } |
109 | 109 | |
110 | - public static function if(string $condition, string $type='') : Mailcode_Commands_Command_If |
|
110 | + public static function if (string $condition, string $type = '') : Mailcode_Commands_Command_If |
|
111 | 111 | { |
112 | 112 | return self::$commandSets->if()->if($condition, $type); |
113 | 113 | } |
114 | 114 | |
115 | - public static function ifVar(string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable |
|
115 | + public static function ifVar(string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If_Variable |
|
116 | 116 | { |
117 | 117 | return self::$commandSets->if()->ifVar($variable, $operand, $value, $quoteValue); |
118 | 118 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | return self::$commandSets->if()->ifVarString($variable, $operand, $value); |
123 | 123 | } |
124 | 124 | |
125 | - public static function ifVarEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable |
|
125 | + public static function ifVarEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If_Variable |
|
126 | 126 | { |
127 | 127 | return self::$commandSets->if()->ifVarEquals($variable, $value, $quoteValue); |
128 | 128 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | return self::$commandSets->if()->ifVarEqualsString($variable, $value); |
133 | 133 | } |
134 | 134 | |
135 | - public static function ifVarNotEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable |
|
135 | + public static function ifVarNotEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If_Variable |
|
136 | 136 | { |
137 | 137 | return self::$commandSets->if()->ifVarNotEquals($variable, $value, $quoteValue); |
138 | 138 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | return self::$commandSets->if()->ifVarNotEqualsString($variable, $value); |
143 | 143 | } |
144 | 144 | |
145 | - public static function elseIf(string $condition, string $type='') : Mailcode_Commands_Command_ElseIf |
|
145 | + public static function elseIf (string $condition, string $type = '') : Mailcode_Commands_Command_ElseIf |
|
146 | 146 | { |
147 | 147 | return self::$commandSets->elseIf()->elseIf($condition, $type); |
148 | 148 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | return self::$commandSets->elseIf()->elseIfNotEmpty($variable); |
158 | 158 | } |
159 | 159 | |
160 | - public static function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable |
|
160 | + public static function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable |
|
161 | 161 | { |
162 | 162 | return self::$commandSets->elseIf()->elseIfVar($variable, $operand, $value, $quoteValue); |
163 | 163 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | return self::$commandSets->elseIf()->elseIfVarString($variable, $operand, $value); |
168 | 168 | } |
169 | 169 | |
170 | - public static function elseIfVarEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable |
|
170 | + public static function elseIfVarEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable |
|
171 | 171 | { |
172 | 172 | return self::$commandSets->elseIf()->elseIfVarEquals($variable, $value, $quoteValue); |
173 | 173 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | return self::$commandSets->elseIf()->elseIfVarEqualsString($variable, $value); |
178 | 178 | } |
179 | 179 | |
180 | - public static function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable |
|
180 | + public static function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable |
|
181 | 181 | { |
182 | 182 | return self::$commandSets->elseIf()->elseIfVarNotEquals($variable, $value, $quoteValue); |
183 | 183 | } |
@@ -187,27 +187,27 @@ discard block |
||
187 | 187 | return self::$commandSets->elseIf()->elseIfVarNotEqualsString($variable, $value); |
188 | 188 | } |
189 | 189 | |
190 | - public static function ifBeginsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_BeginsWith |
|
190 | + public static function ifBeginsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_BeginsWith |
|
191 | 191 | { |
192 | 192 | return self::$commandSets->if()->ifBeginsWith($variable, $search, $caseInsensitive); |
193 | 193 | } |
194 | 194 | |
195 | - public static function ifEndsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_EndsWith |
|
195 | + public static function ifEndsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_EndsWith |
|
196 | 196 | { |
197 | 197 | return self::$commandSets->if()->ifEndsWith($variable, $search, $caseInsensitive); |
198 | 198 | } |
199 | 199 | |
200 | - public static function elseIfBeginsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_BeginsWith |
|
200 | + public static function elseIfBeginsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_BeginsWith |
|
201 | 201 | { |
202 | 202 | return self::$commandSets->elseIf()->elseIfBeginsWith($variable, $search, $caseInsensitive); |
203 | 203 | } |
204 | 204 | |
205 | - public static function elseIfEndsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_EndsWith |
|
205 | + public static function elseIfEndsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_EndsWith |
|
206 | 206 | { |
207 | 207 | return self::$commandSets->elseIf()->elseIfEndsWith($variable, $search, $caseInsensitive); |
208 | 208 | } |
209 | 209 | |
210 | - public static function ifContains(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_Contains |
|
210 | + public static function ifContains(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_Contains |
|
211 | 211 | { |
212 | 212 | return self::$commandSets->if()->ifContains($variable, array($search), $caseInsensitive); |
213 | 213 | } |
@@ -220,12 +220,12 @@ discard block |
||
220 | 220 | * @param bool $caseInsensitive |
221 | 221 | * @return Mailcode_Commands_Command_If_Contains |
222 | 222 | */ |
223 | - public static function ifContainsAny(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_Contains |
|
223 | + public static function ifContainsAny(string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_Contains |
|
224 | 224 | { |
225 | 225 | return self::$commandSets->if()->ifContains($variable, $searchTerms, $caseInsensitive); |
226 | 226 | } |
227 | 227 | |
228 | - public static function elseIfContains(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_Contains |
|
228 | + public static function elseIfContains(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_Contains |
|
229 | 229 | { |
230 | 230 | return self::$commandSets->elseIf()->elseIfContains($variable, array($search), $caseInsensitive); |
231 | 231 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * @param bool $caseInsensitive |
239 | 239 | * @return Mailcode_Commands_Command_ElseIf_Contains |
240 | 240 | */ |
241 | - public static function elseIfContainsAny(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_Contains |
|
241 | + public static function elseIfContainsAny(string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_Contains |
|
242 | 242 | { |
243 | 243 | return self::$commandSets->elseIf()->elseIfContains($variable, $searchTerms, $caseInsensitive); |
244 | 244 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | return self::$commandSets->if()->ifNotEmpty($variable); |
254 | 254 | } |
255 | 255 | |
256 | - public static function for(string $sourceVariable, string $loopVariable) : Mailcode_Commands_Command_For |
|
256 | + public static function for (string $sourceVariable, string $loopVariable) : Mailcode_Commands_Command_For |
|
257 | 257 | { |
258 | 258 | return self::$commandSets->misc()->for($sourceVariable, $loopVariable); |
259 | 259 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | |
294 | 294 | public static function init() : void |
295 | 295 | { |
296 | - if(!isset(self::$commandSets)) |
|
296 | + if (!isset(self::$commandSets)) |
|
297 | 297 | { |
298 | 298 | self::$commandSets = new Mailcode_Factory_CommandSets(); |
299 | 299 | } |
@@ -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 | } |