Passed
Push — master ( a60ac2...b0c01a )
by
unknown
09:12
created
src/Mailcode/Collection.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function addCommand(Mailcode_Commands_Command $command) : Mailcode_Collection
47 47
     {
48
-        if($this->finalized)
48
+        if ($this->finalized)
49 49
         {
50 50
             throw new Mailcode_Exception(
51 51
                 'Cannot add commands to a finalized collection',
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
     {
88 88
         $keep = array();
89 89
 
90
-        foreach($this->commands as $existing)
90
+        foreach ($this->commands as $existing)
91 91
         {
92
-            if($existing !== $command)
92
+            if ($existing !== $command)
93 93
             {
94 94
                 $keep[] = $existing;
95 95
             }
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
 
127 127
         $hashes = array();
128 128
         
129
-        foreach($this->commands as $command)
129
+        foreach ($this->commands as $command)
130 130
         {
131 131
             $hash = $command->getHash();
132 132
             
133
-            if(!isset($hashes[$hash]))
133
+            if (!isset($hashes[$hash]))
134 134
             {
135 135
                 $hashes[$hash] = $command;
136 136
             }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      */
149 149
     public function addCommands(array $commands) : Mailcode_Collection
150 150
     {
151
-        foreach($commands as $command)
151
+        foreach ($commands as $command)
152 152
         {
153 153
             $this->addCommand($command);
154 154
         }
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
         $collection = new Mailcode_Variables_Collection_Regular();
173 173
         
174
-        foreach($this->commands as $command)
174
+        foreach ($this->commands as $command)
175 175
         {
176 176
             $collection->mergeWith($command->getVariables());
177 177
         }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
     {
212 212
         $this->validate();
213 213
 
214
-        if(isset($this->validationResult))
214
+        if (isset($this->validationResult))
215 215
         {
216 216
             return $this->validationResult;
217 217
         }
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
     private function validate() : void
227 227
     {
228
-        if(isset($this->validationResult) || $this->validating)
228
+        if (isset($this->validationResult) || $this->validating)
229 229
         {
230 230
             return;
231 231
         }
@@ -245,9 +245,9 @@  discard block
 block discarded – undo
245 245
     {
246 246
         $errors = $this->getErrors();
247 247
         
248
-        foreach($errors as $error)
248
+        foreach ($errors as $error)
249 249
         {
250
-            if($error->getCode() === $code)
250
+            if ($error->getCode() === $code)
251 251
             {
252 252
                 return true;
253 253
             }
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 
283 283
         $errors = $this->errors;
284 284
 
285
-        if(!$result->isValid())
285
+        if (!$result->isValid())
286 286
         {
287 287
             $errors[] = new Mailcode_Collection_Error_Message(
288 288
                 '',
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
     {
299 299
         $errors = $this->getErrors();
300 300
 
301
-        if(!empty($errors))
301
+        if (!empty($errors))
302 302
         {
303 303
             return array_shift($errors);
304 304
         }
@@ -319,11 +319,11 @@  discard block
 block discarded – undo
319 319
 
320 320
     private function validateNesting() : void
321 321
     {
322
-        foreach($this->commands as $command)
322
+        foreach ($this->commands as $command)
323 323
         {
324 324
             $command->validateNesting();
325 325
 
326
-            if(!$command->isValid()) {
326
+            if (!$command->isValid()) {
327 327
                 $this->addInvalidCommand($command);
328 328
             }
329 329
         }
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
     {
401 401
         $commands = $this->getCommands();
402 402
         
403
-        if(!empty($commands))
403
+        if (!empty($commands))
404 404
         {
405 405
             return array_shift($commands);
406 406
         }
@@ -432,16 +432,16 @@  discard block
 block discarded – undo
432 432
      */
433 433
     private function pruneProtectedContentCommands() : void
434 434
     {
435
-        if(!$this->isValid())
435
+        if (!$this->isValid())
436 436
         {
437 437
             return;
438 438
         }
439 439
 
440 440
         $keep = array();
441 441
 
442
-        foreach($this->commands as $command)
442
+        foreach ($this->commands as $command)
443 443
         {
444
-            if(!$command->hasContentParent())
444
+            if (!$command->hasContentParent())
445 445
             {
446 446
                 $keep[] = $command;
447 447
             }
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
         $errors = $this->getErrors();
459 459
         $result = array();
460 460
 
461
-        foreach($errors as $error)
461
+        foreach ($errors as $error)
462 462
         {
463 463
             $result[] = $error->getCode();
464 464
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/URLAnalyzer.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -58,24 +58,24 @@  discard block
 block discarded – undo
58 58
     private function analyzeURL(string $url) : void
59 59
     {
60 60
         // Ignore phone URLs
61
-        if(stripos($url, 'tel:') !== false)
61
+        if (stripos($url, 'tel:') !== false)
62 62
         {
63 63
             return;
64 64
         }
65 65
 
66 66
         $placeholders = $this->safeguard->getPlaceholdersCollection()->getAll();
67 67
 
68
-        foreach($placeholders as $placeholder)
68
+        foreach ($placeholders as $placeholder)
69 69
         {
70 70
             $command = $placeholder->getCommand();
71 71
 
72 72
             // The URL is not found in the replacement text
73
-            if(strpos($url, $placeholder->getReplacementText()) === false)
73
+            if (strpos($url, $placeholder->getReplacementText()) === false)
74 74
             {
75 75
                 continue;
76 76
             }
77 77
 
78
-            if($command instanceof URLEncodingInterface)
78
+            if ($command instanceof URLEncodingInterface)
79 79
             {
80 80
                 $this->applyEncoding($command);
81 81
             }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
     private function applyEncoding(URLEncodingInterface $command) : void
86 86
     {
87
-        if(!$command->isURLDecoded())
87
+        if (!$command->isURLDecoded())
88 88
         {
89 89
             $command->setURLEncoding();
90 90
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Tokenizer/SpecialChars.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@
 block discarded – undo
101 101
     {
102 102
         $replaces = array();
103 103
 
104
-        foreach(self::$charsEncoded as $char => $placeholder)
104
+        foreach (self::$charsEncoded as $char => $placeholder)
105 105
         {
106 106
             $escaped = self::$charsEscaped[$char];
107 107
 
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
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
      */
29 29
     public function getVariable() : Mailcode_Variables_Variable
30 30
     {
31
-        if($this->subject instanceof Mailcode_Variables_Variable)
31
+        if ($this->subject instanceof Mailcode_Variables_Variable)
32 32
         {
33 33
             return $this->subject;
34 34
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Info/Keywords.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     {
44 44
         $token = $this->info->getTokenByIndex($index);
45 45
 
46
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
46
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
47 47
         {
48 48
             return $token;
49 49
         }
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
     {
63 63
         $tokens = $this->getAll();
64 64
 
65
-        foreach($tokens as $token)
65
+        foreach ($tokens as $token)
66 66
         {
67
-            if($token->getKeyword() === $name)
67
+            if ($token->getKeyword() === $name)
68 68
             {
69 69
                 return $token;
70 70
             }
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
         $result = array();
82 82
         $tokens = $this->info->getTokens();
83 83
 
84
-        foreach($tokens as $token)
84
+        foreach ($tokens as $token)
85 85
         {
86
-            if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
86
+            if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
87 87
             {
88 88
                 $result[] = $token;
89 89
             }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      */
103 103
     public function setEnabled(string $keyword, bool $enabled) : Mailcode_Parser_Statement_Info_Keywords
104 104
     {
105
-        if($enabled)
105
+        if ($enabled)
106 106
         {
107 107
             return $this->add($keyword);
108 108
         }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     {
122 122
         $keyword = rtrim($keyword, ':').':';
123 123
 
124
-        if(!$this->hasKeyword($keyword))
124
+        if (!$this->hasKeyword($keyword))
125 125
         {
126 126
             $this->tokenizer->appendKeyword($keyword);
127 127
         }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
         foreach ($keywords as $kw)
168 168
         {
169
-            if($kw->getKeyword() === $keyword)
169
+            if ($kw->getKeyword() === $keyword)
170 170
             {
171 171
                 return true;
172 172
             }
Please login to merge, or discard this patch.
src/Mailcode/Parser/StringPreProcessor.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      */
80 80
     private function stripStyleTags() : void
81 81
     {
82
-        if(!ConvertHelper::isStringHTML($this->subject))
82
+        if (!ConvertHelper::isStringHTML($this->subject))
83 83
         {
84 84
             return;
85 85
         }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
     private function escapeRegexBracketMatch(string $subject, string $needle) : string
95 95
     {
96
-        $replacement =  str_replace(
96
+        $replacement = str_replace(
97 97
             array('{', '}'),
98 98
             array('\{', '\}'),
99 99
             $needle
Please login to merge, or discard this patch.
src/Mailcode/Factory/CommandSets/Set/Show/Snippet.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
 
37 37
         $this->instantiator->checkCommand($cmd);
38 38
 
39
-        if($cmd instanceof Mailcode_Commands_Command_ShowSnippet)
39
+        if ($cmd instanceof Mailcode_Commands_Command_ShowSnippet)
40 40
         {
41 41
             return $cmd;
42 42
         }
Please login to merge, or discard this patch.
src/Mailcode/Factory/CommandSets/Set/Show/URL.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,21 +33,21 @@  discard block
 block discarded – undo
33 33
      * @return Mailcode_Commands_Command_ShowURL
34 34
      * @throws Mailcode_Factory_Exception
35 35
      */
36
-    public function create(string $url, ?string $trackingID=null, array $queryParams=array()) : Mailcode_Commands_Command_ShowURL
36
+    public function create(string $url, ?string $trackingID = null, array $queryParams = array()) : Mailcode_Commands_Command_ShowURL
37 37
     {
38 38
         $contentID = PreParser::storeContent($url);
39 39
 
40 40
         $params = array();
41 41
         $params[] = (string)$contentID;
42 42
 
43
-        if($trackingID !== null)
43
+        if ($trackingID !== null)
44 44
         {
45 45
             $params[] = sprintf('"%s"', $trackingID);
46 46
         }
47 47
 
48
-        if(!empty($queryParams))
48
+        if (!empty($queryParams))
49 49
         {
50
-            foreach($queryParams as $name => $value)
50
+            foreach ($queryParams as $name => $value)
51 51
             {
52 52
                 $params[] = sprintf(
53 53
                     '"%s=%s"',
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
         $this->instantiator->checkCommand($cmd);
70 70
 
71
-        if($cmd instanceof Mailcode_Commands_Command_ShowURL)
71
+        if ($cmd instanceof Mailcode_Commands_Command_ShowURL)
72 72
         {
73 73
             return $cmd;
74 74
         }
Please login to merge, or discard this patch.
src/Mailcode/Factory/CommandSets/Set/Show/Phone.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      * @return Mailcode_Commands_Command_ShowPhone
36 36
      * @throws Mailcode_Factory_Exception
37 37
      */
38
-    public function create(string $variableName, string $sourceFormat, string $urlEncoding=Mailcode_Factory::URL_ENCODING_NONE) : Mailcode_Commands_Command_ShowPhone
38
+    public function create(string $variableName, string $sourceFormat, string $urlEncoding = Mailcode_Factory::URL_ENCODING_NONE) : Mailcode_Commands_Command_ShowPhone
39 39
     {
40 40
         $variableName = $this->instantiator->filterVariableName($variableName);
41 41
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         $this->instantiator->checkCommand($cmd);
59 59
         $this->instantiator->setEncoding($cmd, $urlEncoding);
60 60
 
61
-        if($cmd instanceof Mailcode_Commands_Command_ShowPhone)
61
+        if ($cmd instanceof Mailcode_Commands_Command_ShowPhone)
62 62
         {
63 63
             return $cmd;
64 64
         }
Please login to merge, or discard this patch.