Passed
Push — master ( f87868...1b5df6 )
by Sebastian
02:44
created
src/Mailcode/Commands/Command/For.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
         $keyword = $info->getKeywordByIndex(1);
63 63
         $container = $info->getVariableByIndex(2);
64 64
         
65
-        if($variable && $keyword && $container && $keyword->isForIn())
65
+        if ($variable && $keyword && $container && $keyword->isForIn())
66 66
         {
67 67
             return;
68 68
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Info.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         $operand = $this->getOperandByIndex(1);
49 49
         $value = $this->getTokenByIndex(2);
50 50
         
51
-        if($variable && $operand && $value && $operand->isAssignment())
51
+        if ($variable && $operand && $value && $operand->isAssignment())
52 52
         {
53 53
             return true;
54 54
         }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         $operand = $this->getOperandByIndex(1);
68 68
         $value = $this->getTokenByIndex(2);
69 69
         
70
-        if($variable && $operand && $value && $operand->isComparator())
70
+        if ($variable && $operand && $value && $operand->isComparator())
71 71
         {
72 72
             return true;
73 73
         }
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
     {
85 85
         $result = array();
86 86
         
87
-        foreach($this->tokens as $token)
87
+        foreach ($this->tokens as $token)
88 88
         {
89
-            if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable)
89
+            if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable)
90 90
             {
91 91
                 $result[] = $token->getVariable();
92 92
             }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     {
100 100
         $token = $this->getTokenByIndex($index);
101 101
         
102
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable)
102
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable)
103 103
         {
104 104
             return $token;
105 105
         }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     {
112 112
         $token = $this->getTokenByIndex($index);
113 113
         
114
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
114
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
115 115
         {
116 116
             return $token;
117 117
         }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     {
124 124
         $token = $this->getTokenByIndex($index);
125 125
         
126
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand)
126
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand)
127 127
         {
128 128
             return $token;
129 129
         }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
     
134 134
     public function getTokenByIndex(int $index) : ?Mailcode_Parser_Statement_Tokenizer_Token
135 135
     {
136
-        if(isset($this->tokens[$index]))
136
+        if (isset($this->tokens[$index]))
137 137
         {
138 138
             return $this->tokens[$index];
139 139
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Tokenizer/Token/Variable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
     
25 25
     public function getVariable() : Mailcode_Variables_Variable
26 26
     {
27
-        if($this->subject instanceof Mailcode_Variables_Variable)
27
+        if ($this->subject instanceof Mailcode_Variables_Variable)
28 28
         {
29 29
             return $this->subject;
30 30
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Tokenizer/Token.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
     * @param string $matchedText
41 41
     * @param mixed $subject
42 42
     */
43
-    public function __construct(string $tokenID, string $matchedText, $subject=null)
43
+    public function __construct(string $tokenID, string $matchedText, $subject = null)
44 44
     {
45 45
         $this->tokenID = $tokenID;
46 46
         $this->matchedText = $matchedText;
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Tokenizer.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
     {
135 135
         $result = array();
136 136
         
137
-        foreach($this->tokensOrdered as $token)
137
+        foreach ($this->tokensOrdered as $token)
138 138
         {
139
-            if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Unknown)
139
+            if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Unknown)
140 140
             {
141 141
                 $result[] = $token;
142 142
             }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
     {
150 150
         $unknown = $this->getUnknown();
151 151
         
152
-        if(!empty($unknown))
152
+        if (!empty($unknown))
153 153
         {
154 154
             return array_shift($unknown);
155 155
         }
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
     {
162 162
         $parts = array();
163 163
         
164
-        foreach($this->tokensOrdered as $token)
164
+        foreach ($this->tokensOrdered as $token)
165 165
         {
166 166
             $string = $token->getNormalized();
167 167
             
168
-            if(!empty($string))
168
+            if (!empty($string))
169 169
             {
170 170
                 $parts[] = $string;
171 171
             }
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
     {
179 179
         $this->tokenized = trim($statement);
180 180
         
181
-        foreach($this->tokenCategories as $token)
181
+        foreach ($this->tokenCategories as $token)
182 182
         {
183 183
             $method = 'tokenize_'.$token;
184 184
             
185
-            if(!method_exists($this, $method))
185
+            if (!method_exists($this, $method))
186 186
             {
187 187
                 throw new Mailcode_Exception(
188 188
                     'Unknown statement token.',
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
     * @param string $matchedText
207 207
     * @param mixed $subject
208 208
     */
209
-    protected function registerToken(string $type, string $matchedText, $subject=null) : void
209
+    protected function registerToken(string $type, string $matchedText, $subject = null) : void
210 210
     {
211 211
         $tokenID = $this->generateID();
212 212
         
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
     
224 224
     protected function getTokenByID(string $tokenID) : ?Mailcode_Parser_Statement_Tokenizer_Token
225 225
     {
226
-        foreach($this->tokensTemporary as $token)
226
+        foreach ($this->tokensTemporary as $token)
227 227
         {
228
-            if($token->getID() === $tokenID)
228
+            if ($token->getID() === $tokenID)
229 229
             {
230 230
                 return $token;
231 231
             }
@@ -241,9 +241,9 @@  discard block
 block discarded – undo
241 241
     
242 242
     protected function tokenize_keywords() : void
243 243
     {
244
-        foreach($this->keywords as $keyword)
244
+        foreach ($this->keywords as $keyword)
245 245
         {
246
-            if(strstr($this->tokenized, $keyword))
246
+            if (strstr($this->tokenized, $keyword))
247 247
             {
248 248
                 $this->registerToken('Keyword', $keyword);
249 249
             }
@@ -257,12 +257,12 @@  discard block
 block discarded – undo
257 257
         // over that could not be tokenized.
258 258
         $parts = \AppUtils\ConvertHelper::explodeTrim($this->delimiter, $this->tokenized);
259 259
 
260
-        foreach($parts as $part)
260
+        foreach ($parts as $part)
261 261
         {
262 262
             $token = $this->getTokenByID($part);
263 263
             
264 264
             // if the entry is a token, simply add it.
265
-            if($token)
265
+            if ($token)
266 266
             {
267 267
                 $this->tokensOrdered[] = $token;
268 268
             }
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
     {
279 279
         $vars = Mailcode::create()->findVariables($this->tokenized)->getGroupedByHash();
280 280
         
281
-        foreach($vars as $var)
281
+        foreach ($vars as $var)
282 282
         {
283 283
             $this->registerToken('Variable', $var->getMatchedText(), $var);
284 284
         }
@@ -286,9 +286,9 @@  discard block
 block discarded – undo
286 286
     
287 287
     protected function tokenize_operands() : void
288 288
     {
289
-        foreach($this->operands as $operand)
289
+        foreach ($this->operands as $operand)
290 290
         {
291
-            if(strstr($this->tokenized, $operand))
291
+            if (strstr($this->tokenized, $operand))
292 292
             {
293 293
                 $this->registerToken('Operand', $operand);
294 294
             }
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
         $matches = array();
301 301
         preg_match_all('/"(.*)"/sx', $this->tokenized, $matches, PREG_PATTERN_ORDER);
302 302
         
303
-        foreach($matches[0] as $match)
303
+        foreach ($matches[0] as $match)
304 304
         {
305 305
             $this->registerToken('StringLiteral', $match);
306 306
         }
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
         $matches = array();
312 312
         preg_match_all('/-*[0-9]+\s*[.,]\s*[0-9]+|-*[0-9]+/sx', $this->tokenized, $matches, PREG_PATTERN_ORDER);
313 313
         
314
-        foreach($matches[0] as $match)
314
+        foreach ($matches[0] as $match)
315 315
         {
316 316
             $this->registerToken('Number', $match);
317 317
         }
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
     {
329 329
         static $alphas;
330 330
         
331
-        if(!isset($alphas))
331
+        if (!isset($alphas))
332 332
         {
333 333
             $alphas = range('A', 'Z');
334 334
         }
@@ -337,12 +337,12 @@  discard block
 block discarded – undo
337 337
         
338 338
         $result = '';
339 339
         
340
-        for($i=0; $i < $amount; $i++)
340
+        for ($i = 0; $i < $amount; $i++)
341 341
         {
342 342
             $result .= $alphas[array_rand($alphas)];
343 343
         }
344 344
         
345
-        if(!in_array($result, self::$ids))
345
+        if (!in_array($result, self::$ids))
346 346
         {
347 347
             self::$ids[] = $result;
348 348
             return $result;
Please login to merge, or discard this patch.
src/Mailcode/Factory/Exception.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     * @param \Exception|NULL $previous
33 33
     * @param Mailcode_Commands_Command|NULL $command
34 34
     */
35
-    public function __construct(string $message, $details=null, $code=null, $previous=null, Mailcode_Commands_Command $command=null)
35
+    public function __construct(string $message, $details = null, $code = null, $previous = null, Mailcode_Commands_Command $command = null)
36 36
     {
37 37
         parent::__construct($message, $details, $code, $previous);
38 38
         
Please login to merge, or discard this patch.
src/Mailcode/Factory.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
     * 
62 62
     * @see Mailcode_Factory::ERROR_INVALID_COMMAND_CREATED
63 63
     */
64
-    public static function setVar(string $variableName, string $value, bool $quoteValue=true) : Mailcode_Commands_Command_SetVariable
64
+    public static function setVar(string $variableName, string $value, bool $quoteValue = true) : Mailcode_Commands_Command_SetVariable
65 65
     {
66 66
         $variableName = self::_filterVariableName($variableName);
67 67
         
68
-        if($quoteValue)
68
+        if ($quoteValue)
69 69
         {
70 70
             $value = self::_quoteString($value);
71 71
         }
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
         return $cmd;
139 139
     }
140 140
     
141
-    protected static function _buildIf(string $cmd, string $condition, string $type='') : Mailcode_Commands_Command
141
+    protected static function _buildIf(string $cmd, string $condition, string $type = '') : Mailcode_Commands_Command
142 142
     {
143 143
         $stringType = $type;
144 144
         
145
-        if(!empty($type))
145
+        if (!empty($type))
146 146
         {
147 147
             $stringType = ' '.$type;
148 148
         }
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
         return $cmd;
166 166
     }
167 167
   
168
-    protected static function _buildIfVar(string $cmd, string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command
168
+    protected static function _buildIfVar(string $cmd, string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command
169 169
     {
170
-        if($quoteValue)
170
+        if ($quoteValue)
171 171
         {
172 172
             $value = self::_quoteString($value);
173 173
         }
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
         return self::_buildIf($cmd, $condition, 'variable');
183 183
     }
184 184
     
185
-    public static function if(string $condition, string $type='') : Mailcode_Commands_Command_If
185
+    public static function if (string $condition, string $type = '') : Mailcode_Commands_Command_If
186 186
     {
187 187
         $cmd = self::_buildIf('If', $condition, $type);
188 188
         
189
-        if($cmd instanceof Mailcode_Commands_Command_If)
189
+        if ($cmd instanceof Mailcode_Commands_Command_If)
190 190
         {
191 191
             return $cmd;
192 192
         }
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
         throw self::_exceptionUnexpectedType($cmd);
195 195
     }
196 196
     
197
-    public static function ifVar(string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If
197
+    public static function ifVar(string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If
198 198
     {
199 199
         $cmd = self::_buildIfVar('If', $variable, $operand, $value, $quoteValue);
200 200
         
201
-        if($cmd instanceof Mailcode_Commands_Command_If)
201
+        if ($cmd instanceof Mailcode_Commands_Command_If)
202 202
         {
203 203
             return $cmd;
204 204
         }
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
     {
211 211
         $cmd = self::_buildIfVar('If', $variable, $operand, $value, true);
212 212
         
213
-        if($cmd instanceof Mailcode_Commands_Command_If)
213
+        if ($cmd instanceof Mailcode_Commands_Command_If)
214 214
         {
215 215
             return $cmd;
216 216
         }
@@ -218,11 +218,11 @@  discard block
 block discarded – undo
218 218
         throw self::_exceptionUnexpectedType($cmd);
219 219
     }
220 220
     
221
-    public static function ifVarEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If
221
+    public static function ifVarEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If
222 222
     {
223 223
         $cmd = self::_buildIfVar('If', $variable, '==', $value, $quoteValue);
224 224
         
225
-        if($cmd instanceof Mailcode_Commands_Command_If)
225
+        if ($cmd instanceof Mailcode_Commands_Command_If)
226 226
         {
227 227
             return $cmd;
228 228
         }
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
     {
235 235
         $cmd = self::_buildIfVar('If', $variable, '==', $value, true);
236 236
         
237
-        if($cmd instanceof Mailcode_Commands_Command_If)
237
+        if ($cmd instanceof Mailcode_Commands_Command_If)
238 238
         {
239 239
             return $cmd;
240 240
         }
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
         throw self::_exceptionUnexpectedType($cmd);
243 243
     }
244 244
     
245
-    public static function ifVarNotEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If
245
+    public static function ifVarNotEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If
246 246
     {
247 247
         $cmd = self::_buildIfVar('If', $variable, '!=', $value, $quoteValue);
248 248
         
249
-        if($cmd instanceof Mailcode_Commands_Command_If)
249
+        if ($cmd instanceof Mailcode_Commands_Command_If)
250 250
         {
251 251
             return $cmd;
252 252
         }
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
     {
259 259
         $cmd = self::_buildIfVar('If', $variable, '!=', $value, true);
260 260
         
261
-        if($cmd instanceof Mailcode_Commands_Command_If)
261
+        if ($cmd instanceof Mailcode_Commands_Command_If)
262 262
         {
263 263
             return $cmd;
264 264
         }
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
         throw self::_exceptionUnexpectedType($cmd);
267 267
     }
268 268
     
269
-    public static function elseIf(string $condition, string $type='') : Mailcode_Commands_Command_ElseIf
269
+    public static function elseIf (string $condition, string $type = '') : Mailcode_Commands_Command_ElseIf
270 270
     {
271 271
         $cmd = self::_buildIf('ElseIf', $condition, $type);
272 272
         
273
-        if($cmd instanceof Mailcode_Commands_Command_ElseIf)
273
+        if ($cmd instanceof Mailcode_Commands_Command_ElseIf)
274 274
         {
275 275
             return $cmd;
276 276
         }
@@ -278,11 +278,11 @@  discard block
 block discarded – undo
278 278
         throw self::_exceptionUnexpectedType($cmd);
279 279
     }
280 280
     
281
-    public static function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf
281
+    public static function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf
282 282
     {
283 283
         $cmd = self::_buildIfVar('ElseIf', $variable, $operand, $value, $quoteValue);
284 284
         
285
-        if($cmd instanceof Mailcode_Commands_Command_ElseIf)
285
+        if ($cmd instanceof Mailcode_Commands_Command_ElseIf)
286 286
         {
287 287
             return $cmd;
288 288
         }
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
     {
295 295
         $cmd = self::_buildIfVar('ElseIf', $variable, $operand, $value, true);
296 296
         
297
-        if($cmd instanceof Mailcode_Commands_Command_ElseIf)
297
+        if ($cmd instanceof Mailcode_Commands_Command_ElseIf)
298 298
         {
299 299
             return $cmd;
300 300
         }
@@ -302,11 +302,11 @@  discard block
 block discarded – undo
302 302
         throw self::_exceptionUnexpectedType($cmd);
303 303
     }
304 304
     
305
-    public static function elseIfVarEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf
305
+    public static function elseIfVarEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf
306 306
     {
307 307
         $cmd = self::_buildIfVar('ElseIf', $variable, '==', $value, $quoteValue);
308 308
         
309
-        if($cmd instanceof Mailcode_Commands_Command_ElseIf)
309
+        if ($cmd instanceof Mailcode_Commands_Command_ElseIf)
310 310
         {
311 311
             return $cmd;
312 312
         }
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
     {
319 319
         $cmd = self::_buildIfVar('ElseIf', $variable, '==', $value, true);
320 320
         
321
-        if($cmd instanceof Mailcode_Commands_Command_ElseIf)
321
+        if ($cmd instanceof Mailcode_Commands_Command_ElseIf)
322 322
         {
323 323
             return $cmd;
324 324
         }
@@ -326,11 +326,11 @@  discard block
 block discarded – undo
326 326
         throw self::_exceptionUnexpectedType($cmd);
327 327
     }
328 328
     
329
-    public static function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf
329
+    public static function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf
330 330
     {
331 331
         $cmd = self::_buildIfVar('ElseIf', $variable, '!=', $value, $quoteValue);
332 332
         
333
-        if($cmd instanceof Mailcode_Commands_Command_ElseIf)
333
+        if ($cmd instanceof Mailcode_Commands_Command_ElseIf)
334 334
         {
335 335
             return $cmd;
336 336
         }
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
     {
343 343
         $cmd = self::_buildIfVar('ElseIf', $variable, '!=', $value, true);
344 344
         
345
-        if($cmd instanceof Mailcode_Commands_Command_ElseIf)
345
+        if ($cmd instanceof Mailcode_Commands_Command_ElseIf)
346 346
         {
347 347
             return $cmd;
348 348
         }
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
     
369 369
     protected static function _checkCommand(Mailcode_Commands_Command $command) : void
370 370
     {
371
-        if($command->isValid())
371
+        if ($command->isValid())
372 372
         {
373 373
             return;
374 374
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     */
116 116
     public function setDelimiter(string $delimiter) : Mailcode_Parser_Safeguard
117 117
     {
118
-        if(empty($delimiter))
118
+        if (empty($delimiter))
119 119
         {
120 120
             throw new Mailcode_Exception(
121 121
                 'Empty delimiter',
@@ -156,17 +156,17 @@  discard block
 block discarded – undo
156 156
     * @param bool $highlighted
157 157
     * @return string[]string
158 158
     */
159
-    protected function getReplaces(bool $highlighted=false) : array
159
+    protected function getReplaces(bool $highlighted = false) : array
160 160
     {
161 161
         $placeholders = $this->getPlaceholders();
162 162
         
163 163
         $replaces = array();
164 164
         
165
-        foreach($placeholders as $placeholder)
165
+        foreach ($placeholders as $placeholder)
166 166
         {
167 167
             $replace = '';
168 168
             
169
-            if($highlighted)
169
+            if ($highlighted)
170 170
             {
171 171
                 $replace = $placeholder->getHighlightedText();
172 172
             }
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
     */
191 191
     public function getPlaceholders()
192 192
     {
193
-        if(isset($this->placeholders))
193
+        if (isset($this->placeholders))
194 194
         {
195 195
             return $this->placeholders;
196 196
         }
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         
200 200
         $cmds = $this->getCollection()->getGroupedByHash();
201 201
         
202
-        foreach($cmds as $command)
202
+        foreach ($cmds as $command)
203 203
         {
204 204
             self::$counter++;
205 205
             
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
         return $this->placeholders;
214 214
     }
215 215
     
216
-    protected function restore(string $string, bool $highlighted=false) : string
216
+    protected function restore(string $string, bool $highlighted = false) : string
217 217
     {
218 218
         $this->requireValidCollection();
219 219
         
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
         
222 222
         $placeholderStrings = array_keys($replaces);
223 223
         
224
-        foreach($placeholderStrings as $search)
224
+        foreach ($placeholderStrings as $search)
225 225
         {
226
-            if(!strstr($string, $search))
226
+            if (!strstr($string, $search))
227 227
             {
228 228
                 throw new Mailcode_Exception(
229 229
                     'Command placeholder not found',
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
     */
282 282
     public function getCollection() : Mailcode_Collection
283 283
     {
284
-        if(isset($this->collection))
284
+        if (isset($this->collection))
285 285
         {
286 286
             return $this->collection;
287 287
         }
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
     */
304 304
     protected function requireValidCollection() : void
305 305
     {
306
-        if($this->getCollection()->isValid())
306
+        if ($this->getCollection()->isValid())
307 307
         {
308 308
             return;
309 309
         }
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
     */
326 326
     public function getPlaceholderStrings() : array
327 327
     {
328
-        if(isset($this->placeholderStrings))
328
+        if (isset($this->placeholderStrings))
329 329
         {
330 330
             return $this->placeholderStrings;
331 331
         }
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
         
335 335
         $this->placeholderStrings = array();
336 336
         
337
-        foreach($placeholders as $placeholder)
337
+        foreach ($placeholders as $placeholder)
338 338
         {
339 339
             $this->placeholderStrings[] = $placeholder->getReplacementText();
340 340
         }
@@ -360,9 +360,9 @@  discard block
 block discarded – undo
360 360
     {
361 361
         $placeholders = $this->getPlaceholders();
362 362
         
363
-        foreach($placeholders as $placeholder)
363
+        foreach ($placeholders as $placeholder)
364 364
         {
365
-            if($placeholder->getID() === $id)
365
+            if ($placeholder->getID() === $id)
366 366
             {
367 367
                 return $placeholder;
368 368
             }
@@ -389,9 +389,9 @@  discard block
 block discarded – undo
389 389
     {
390 390
         $placeholders = $this->getPlaceholders();
391 391
         
392
-        foreach($placeholders as $placeholder)
392
+        foreach ($placeholders as $placeholder)
393 393
         {
394
-            if($placeholder->getReplacementText() === $string)
394
+            if ($placeholder->getReplacementText() === $string)
395 395
             {
396 396
                 return $placeholder;
397 397
             }
Please login to merge, or discard this patch.
src/Mailcode/Variables/Collection.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
     {
63 63
         $fullName = $this->fixName($fullName);
64 64
         
65
-        foreach($this->variables as $variable)
65
+        foreach ($this->variables as $variable)
66 66
         {
67
-            if($variable->getFullName() === $fullName)
67
+            if ($variable->getFullName() === $fullName)
68 68
             {
69 69
                 return true;
70 70
             }
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
         
88 88
         $collection = new Mailcode_Variables_Collection_Regular();
89 89
         
90
-        foreach($this->variables as $variable)
90
+        foreach ($this->variables as $variable)
91 91
         {
92
-            if($variable->getFullName() === $fullName)
92
+            if ($variable->getFullName() === $fullName)
93 93
             {
94 94
                 $collection->add($variable);
95 95
             }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     */
107 107
     protected function fixName(string $fullName) : string
108 108
     {
109
-        if(substr($fullName, 0, 1) === '$')
109
+        if (substr($fullName, 0, 1) === '$')
110 110
         {
111 111
             return $fullName;
112 112
         }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     {
125 125
         $entries = array();
126 126
         
127
-        foreach($this->variables as $variable)
127
+        foreach ($this->variables as $variable)
128 128
         {
129 129
             $entries[$variable->getHash()] = $variable;
130 130
         }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     {
142 142
         $entries = array();
143 143
         
144
-        foreach($this->variables as $variable)
144
+        foreach ($this->variables as $variable)
145 145
         {
146 146
             $entries[$variable->getFullName()] = $variable;
147 147
         }
@@ -166,11 +166,11 @@  discard block
 block discarded – undo
166 166
     {
167 167
         $result = array();
168 168
         
169
-        foreach($this->variables as $variable)
169
+        foreach ($this->variables as $variable)
170 170
         {
171 171
             $name = $variable->getFullName();
172 172
             
173
-            if(!in_array($name, $result))
173
+            if (!in_array($name, $result))
174 174
             {
175 175
                 $result[] = $name;
176 176
             }
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
     {
210 210
         $variables = $collection->getGroupedByHash();
211 211
         
212
-        foreach($variables as $variable)
212
+        foreach ($variables as $variable)
213 213
         {
214 214
             $this->add($variable);
215 215
         }
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
     {
222 222
         $variables = $this->getAll();
223 223
         
224
-        if(!empty($variables))
224
+        if (!empty($variables))
225 225
         {
226 226
             return array_shift($variables);
227 227
         }
Please login to merge, or discard this patch.