Test Failed
Push — master ( 956a64...151bf3 )
by Sebastian
02:46
created
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.
src/Mailcode/Parser/Safeguard/Formatter/Type/SingleLines/Location.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         $position = $this->getStartPosition();
56 56
         
57 57
         // we're at the beginning of the string
58
-        if($position === false || $position === 0)
58
+        if ($position === false || $position === 0)
59 59
         {
60 60
             $this->log(sprintf(
61 61
                 'Prepend: NO | Position: [%s] | Not found, or at beginning of string.', 
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
         
68 68
         $prevPos = $position - $this->eolLength;
69 69
         
70
-        if($prevPos < 0)
70
+        if ($prevPos < 0)
71 71
         {
72 72
             $prevPos = 0;
73 73
         }
74 74
         
75
-        if($this->isWithinCommand($prevPos))
75
+        if ($this->isWithinCommand($prevPos))
76 76
         {
77 77
             $this->log(sprintf(
78 78
                 'Prepend: NO | Position: [%s] | Is within a mailcode command.', 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         
85 85
         $prev = $this->subject->getSubstr($prevPos, $this->eolLength);
86 86
         
87
-        if($prev !== $this->formatter->getEOLChar())
87
+        if ($prev !== $this->formatter->getEOLChar())
88 88
         {
89 89
             $this->log(sprintf(
90 90
                 'Prepend: YES | Position: [%s] | Characters: [%s] | Do not match the EOL character.',
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         $position = $this->getEndPosition();
104 104
         
105 105
         // we're at the end of the string
106
-        if($position === false || $position >= $subjectLength)
106
+        if ($position === false || $position >= $subjectLength)
107 107
         {
108 108
             $this->log(sprintf(
109 109
                 'Append: NO | Position: [%s] | End of string, or too long | Subject length: [%s]',
@@ -116,12 +116,12 @@  discard block
 block discarded – undo
116 116
         
117 117
         $nextPos = $position + $this->eolLength;
118 118
         
119
-        if($nextPos > $subjectLength)
119
+        if ($nextPos > $subjectLength)
120 120
         {
121 121
             $nextPos = $subjectLength - $this->eolLength;
122 122
         }
123 123
         
124
-        if($this->isWithinCommand($nextPos))
124
+        if ($this->isWithinCommand($nextPos))
125 125
         {
126 126
             $this->log(sprintf(
127 127
                 'Append: YES | Position: [%s] | Is within a mailcode command.',
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         
136 136
         $next = $this->subject->getSubstr($nextPos, $this->eolLength);
137 137
         
138
-        if($next !== $this->formatter->getEOLChar())
138
+        if ($next !== $this->formatter->getEOLChar())
139 139
         {
140 140
             $this->log(sprintf(
141 141
                 'Append: YES | Position: [%s] | Next characters: [%s] | Do not match the EOL character.',
Please login to merge, or discard this patch.
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/ReplacerType.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     {
30 30
         $locations = $this->resolveLocations();
31 31
         
32
-        foreach($locations as $location)
32
+        foreach ($locations as $location)
33 33
         {
34 34
             $location->replaceWith($this->resolveReplacement($location));
35 35
             
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     */
47 47
     private function resolveReplacement(Mailcode_Parser_Safeguard_Formatter_Location $location) : string
48 48
     {
49
-        if($location->requiresAdjustment())
49
+        if ($location->requiresAdjustment())
50 50
         {
51 51
             return $this->getReplaceString($location);
52 52
         }
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
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         
78 78
         $instance = new $class($this, $placeholder);
79 79
         
80
-        if($instance instanceof Mailcode_Parser_Safeguard_Formatter_Location)
80
+        if ($instance instanceof Mailcode_Parser_Safeguard_Formatter_Location)
81 81
         {
82 82
             return $instance;
83 83
         }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         
106 106
         $result = array();
107 107
         
108
-        foreach($placeholders as $placeholder)
108
+        foreach ($placeholders as $placeholder)
109 109
         {
110 110
             $result[] = $this->createLocation($placeholder);
111 111
         }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     {
124 124
         $eol = ConvertHelper::detectEOLCharacter($subject);
125 125
         
126
-        if($eol)
126
+        if ($eol)
127 127
         {
128 128
             $this->log(sprintf(
129 129
                 'Detected EOL character: %s.', 
Please login to merge, or discard this patch.