Test Failed
Push — master ( 81711e...bf8774 )
by Sebastian
03:41
created
src/Mailcode/Parser/Safeguard/Formatter/FormatType.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
     {
35 35
         $locations = $this->resolveLocations();
36 36
         
37
-        foreach($locations as $location)
37
+        foreach ($locations as $location)
38 38
         {
39 39
             $location->format();
40 40
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/Formatter/Location.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -84,23 +84,23 @@  discard block
 block discarded – undo
84 84
         
85 85
         $placeholderID = $this->placeholder->getID();
86 86
         
87
-        foreach($placeholders as $placeholder)
87
+        foreach ($placeholders as $placeholder)
88 88
         {
89
-            if($placeholder->getID() === $placeholderID)
89
+            if ($placeholder->getID() === $placeholderID)
90 90
             {
91 91
                 continue;
92 92
             }
93 93
             
94 94
             $start = $this->subject->getSubstrPosition($placeholder->getReplacementText());
95 95
             
96
-            if($start === false)
96
+            if ($start === false)
97 97
             {
98 98
                 continue;
99 99
             }
100 100
             
101 101
             $end = $start + $placeholder->getLength();
102 102
             
103
-            if($position >= $start && $position <= $end)
103
+            if ($position >= $start && $position <= $end)
104 104
             {
105 105
                 return true;
106 106
             }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     {
117 117
         $start = $this->getStartPosition();
118 118
         
119
-        if($start !== false)
119
+        if ($start !== false)
120 120
         {
121 121
             return $start + $this->placeholder->getLength();
122 122
         }
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
     {
147 147
         $needle = $this->placeholder->getReplacementText();
148 148
         
149
-        if($this->subject->replaceSubstrings($needle, $replacementText))
149
+        if ($this->subject->replaceSubstrings($needle, $replacementText))
150 150
         {
151 151
             return;
152 152
         }
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
     
164 164
     public function format() : void
165 165
     {
166
-        if($this->requiresAdjustment() && (!empty($this->prepend) || !empty($this->append)))
166
+        if ($this->requiresAdjustment() && (!empty($this->prepend) || !empty($this->append)))
167 167
         {
168 168
             $this->replaceWith(sprintf(
169 169
                 '%s%s%s',
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/Formatter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         
73 73
         $instance = new $class($this, $placeholder);
74 74
         
75
-        if($instance instanceof Mailcode_Parser_Safeguard_Formatter_Location)
75
+        if ($instance instanceof Mailcode_Parser_Safeguard_Formatter_Location)
76 76
         {
77 77
             return $instance;
78 78
         }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         
101 101
         $result = array();
102 102
         
103
-        foreach($placeholders as $placeholder)
103
+        foreach ($placeholders as $placeholder)
104 104
         {
105 105
             $result[] = $this->createLocation($placeholder);
106 106
         }
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     {
119 119
         $eol = ConvertHelper::detectEOLCharacter($subject);
120 120
         
121
-        if($eol)
121
+        if ($eol)
122 122
         {
123 123
             return $eol->getCharacter();
124 124
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/Formatting.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     
132 132
     public function applyFormatting() : void
133 133
     {
134
-        if($this->applied)
134
+        if ($this->applied)
135 135
         {
136 136
             return;
137 137
         }
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
 
147 147
     private function applyFormatTypes() : void
148 148
     {
149
-        foreach($this->formatters as $formatter)
149
+        foreach ($this->formatters as $formatter)
150 150
         {
151
-            if($formatter instanceof Mailcode_Parser_Safeguard_Formatter_FormatType)
151
+            if ($formatter instanceof Mailcode_Parser_Safeguard_Formatter_FormatType)
152 152
             {
153 153
                 $formatter->format();
154 154
             }
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
     
158 158
     private function applyReplaceTypes() : void
159 159
     {
160
-        foreach($this->formatters as $formatter)
160
+        foreach ($this->formatters as $formatter)
161 161
         {
162
-            if($formatter instanceof Mailcode_Parser_Safeguard_Formatter_ReplacerType)
162
+            if ($formatter instanceof Mailcode_Parser_Safeguard_Formatter_ReplacerType)
163 163
             {
164 164
                 $formatter->replace();
165 165
             }
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     
169 169
     private function validateFormatters() : void
170 170
     {
171
-        if(empty($this->formatters))
171
+        if (empty($this->formatters))
172 172
         {
173 173
             throw new Mailcode_Exception(
174 174
                 'No formatters selected',
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
         
180 180
         $amount = $this->countReplacers();
181 181
         
182
-        if($amount > 1) 
182
+        if ($amount > 1) 
183 183
         {
184 184
             throw new Mailcode_Exception(
185 185
                 'More than one replacer formatter selected',
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         }
190 190
         
191 191
         // by default, at minimum the normalized formatter must be selected.
192
-        if($amount === 0)
192
+        if ($amount === 0)
193 193
         {
194 194
             $this->replaceWithNormalized();
195 195
         }
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
     {
205 205
         $count = 0;
206 206
         
207
-        foreach($this->formatters as $formatter)
207
+        foreach ($this->formatters as $formatter)
208 208
         {
209
-            if($formatter instanceof Mailcode_Parser_Safeguard_Formatter_ReplacerType)
209
+            if ($formatter instanceof Mailcode_Parser_Safeguard_Formatter_ReplacerType)
210 210
             {
211 211
                 $count++;
212 212
             }
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
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
src/Mailcode/StringContainer.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.