Passed
Push — master ( b87bd2...81711e )
by Sebastian
03:45
created
src/Mailcode/Commands/Command/SetVariable.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     {
74 74
         $val = $this->validator->createVariable()->setIndex(0);
75 75
         
76
-        if($val->isValid())
76
+        if ($val->isValid())
77 77
         {
78 78
             $this->variableToken = $val->getToken();
79 79
         }
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
     {
91 91
         $tokens = $this->params->getInfo()->createPruner()->limitToOperands()->getTokens();
92 92
 
93
-        foreach($tokens as $token)
93
+        foreach ($tokens as $token)
94 94
         {
95
-            if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand)
95
+            if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand)
96 96
             {
97 97
                 $this->validateOperand($token);
98 98
             }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         
109 109
         // ensure that the operand we have in the command is one of the
110 110
         // allowed ones.
111
-        if(!in_array($sign, $allowed))
111
+        if (!in_array($sign, $allowed))
112 112
         {
113 113
             $this->validationResult->makeError(
114 114
                 t('The %1$s sign is not allowed in this command.', '<code>'.$sign.'</code>'),
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     {
122 122
         $tokens = $this->getAssignmentTokens();
123 123
         
124
-        if(empty($tokens))
124
+        if (empty($tokens))
125 125
         {
126 126
             $this->validationResult->makeError(
127 127
                 t('No value assigned to the variable.'),
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
     
133 133
     public function getVariable() : Mailcode_Variables_Variable
134 134
     {
135
-        if($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable)
135
+        if ($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable)
136 136
         {
137 137
             return $this->variableToken->getVariable();
138 138
         }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         $eq = array_shift($params); // equals sign
157 157
         
158 158
         // in case the equals sign was omitted.
159
-        if(!$eq instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand)
159
+        if (!$eq instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand)
160 160
         {
161 161
             array_unshift($params, $eq);
162 162
         }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
         
171 171
         $items = array();
172 172
         
173
-        foreach($tokens as $token)
173
+        foreach ($tokens as $token)
174 174
         {
175 175
             $items[] = $token->getNormalized();
176 176
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/Formatter/SingleLines.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,9 +64,9 @@
 block discarded – undo
64 64
         
65 65
         $result = array();
66 66
         
67
-        foreach($placeholders as $placeholder)
67
+        foreach ($placeholders as $placeholder)
68 68
         {
69
-            if(!$placeholder->getCommand()->generatesContent())
69
+            if (!$placeholder->getCommand()->generatesContent())
70 70
             {
71 71
                 $result[] = $placeholder;
72 72
             }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/Formatter/SingleLines/Location.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -77,21 +77,21 @@  discard block
 block discarded – undo
77 77
         $position = $this->location->getStartPosition();
78 78
         
79 79
         // we're at the beginning of the string
80
-        if($position == 0)
80
+        if ($position == 0)
81 81
         {
82 82
             return;
83 83
         }
84 84
         
85 85
         $prevPos = $position - $this->eolLength;
86 86
         
87
-        if($prevPos < 0)
87
+        if ($prevPos < 0)
88 88
         {
89 89
             $prevPos = 0;
90 90
         }
91 91
         
92 92
         $prev = mb_substr($this->location->getSubjectString(), $prevPos, $this->eolLength);
93 93
         
94
-        if($prev !== $this->formatter->getEOLChar())
94
+        if ($prev !== $this->formatter->getEOLChar())
95 95
         {
96 96
             $this->prepend = true;
97 97
         }
@@ -104,21 +104,21 @@  discard block
 block discarded – undo
104 104
         $position = $this->location->getEndPosition();
105 105
         
106 106
         // we're at the end of the string
107
-        if($position >= $subjectLength)
107
+        if ($position >= $subjectLength)
108 108
         {
109 109
             return;
110 110
         }
111 111
         
112 112
         $nextPos = $position + $this->eolLength;
113 113
         
114
-        if($nextPos > $subjectLength)
114
+        if ($nextPos > $subjectLength)
115 115
         {
116 116
             $nextPos = $subjectLength - $this->eolLength;
117 117
         }
118 118
         
119 119
         $next = mb_substr($this->location->getSubjectString(), $nextPos, $this->eolLength);
120 120
         
121
-        if($next !== $this->formatter->getEOLChar())
121
+        if ($next !== $this->formatter->getEOLChar())
122 122
         {
123 123
             $this->append = true;
124 124
         }
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
         $prepend = '';
130 130
         $append = '';
131 131
         
132
-        if($this->requiresPrepend())
132
+        if ($this->requiresPrepend())
133 133
         {
134 134
             $prepend = $this->eol;
135 135
         }
136 136
         
137
-        if($this->requiresAppend())
137
+        if ($this->requiresAppend())
138 138
         {
139 139
             $append = $this->eol;
140 140
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/Formatter/HTMLHighlighting/Location.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
     public function requiresAdjustment(): bool
49 49
     {
50
-        if($this->isInTagAttributes() || $this->isInExcludedTag()) 
50
+        if ($this->isInTagAttributes() || $this->isInExcludedTag()) 
51 51
         {
52 52
            return false; 
53 53
         }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $pos = $this->location->getStartPosition();
67 67
         
68 68
         // at the beginning of the document? Sure, we can highlight this.
69
-        if($pos === 0)
69
+        if ($pos === 0)
70 70
         {
71 71
             return '';
72 72
         }
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
     {
91 91
         $tagNames = $this->getParentTags();
92 92
         
93
-        foreach($tagNames as $tagName)
93
+        foreach ($tagNames as $tagName)
94 94
         {
95
-            if($this->formatter->isTagExcluded($tagName))
95
+            if ($this->formatter->isTagExcluded($tagName))
96 96
             {
97 97
                 return true;
98 98
             }
@@ -112,11 +112,11 @@  discard block
 block discarded – undo
112 112
         // Create a stack of all direct parent tags of the command.
113 113
         // Handles closing tags as well.
114 114
         $stack = array();
115
-        foreach($this->tagAncestry[2] as $idx => $tagName)
115
+        foreach ($this->tagAncestry[2] as $idx => $tagName)
116 116
         {
117 117
             $closing = $this->tagAncestry[1][$idx] === '/';
118 118
             
119
-            if($closing)
119
+            if ($closing)
120 120
             {
121 121
                 array_pop($stack);
122 122
             }
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
     {
140 140
         // This check is easy: if the command is in the attribute
141 141
         // of any of the tags, we will find the command marker in there.
142
-        foreach($this->tagAncestry[3] as $attributes)
142
+        foreach ($this->tagAncestry[3] as $attributes)
143 143
         {
144
-            if(strstr($attributes, self::COMMAND_MARKER))
144
+            if (strstr($attributes, self::COMMAND_MARKER))
145 145
             {
146 146
                 return true;
147 147
             }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/Formatter/HTMLHighlighting.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     {
47 47
         $tagName = strtolower($tagName);
48 48
         
49
-        if(!in_array($tagName, $this->excludeTags))
49
+        if (!in_array($tagName, $this->excludeTags))
50 50
         {
51 51
             $this->excludeTags[] = $tagName;
52 52
         }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     */
63 63
     public function excludeTags(array $tagNames) : Mailcode_Parser_Safeguard_Formatter_HTMLHighlighting
64 64
     {
65
-        foreach($tagNames as $tagName)
65
+        foreach ($tagNames as $tagName)
66 66
         {
67 67
             $this->excludeTag((string)$tagName);
68 68
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/Formatter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         
63 63
         $total = count($placeholders);
64 64
         
65
-        for($i=0; $i < $total; $i++)
65
+        for ($i = 0; $i < $total; $i++)
66 66
         {
67 67
             $subject = $this->process($placeholders[$i], $subject);
68 68
         }
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
         $locator = $placeholder->createLocator($subject);
76 76
         $positions = $locator->getLocations();
77 77
         
78
-        foreach($positions as $position)
78
+        foreach ($positions as $position)
79 79
         {
80 80
             $replace = $this->resolveReplacementText($position);
81 81
             
82
-            if($replace !== $position->getPlaceholderString())
82
+            if ($replace !== $position->getPlaceholderString())
83 83
             {
84 84
                 $locator->replaceWith($position, $replace);
85 85
             }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     {
99 99
         $eol = ConvertHelper::detectEOLCharacter($subject);
100 100
         
101
-        if($eol)
101
+        if ($eol)
102 102
         {
103 103
             return $eol->getCharacter();
104 104
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/Placeholder/Locator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         $needle = $this->placeholder->getReplacementText();
64 64
         $index = 0;
65 65
         
66
-        while(($lastPos = mb_strpos($this->subject, $needle, $lastPos)) !== false)
66
+        while (($lastPos = mb_strpos($this->subject, $needle, $lastPos)) !== false)
67 67
         {
68 68
             $length = mb_strlen($needle);
69 69
             
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     */
99 99
     public function getLocationByIndex(int $index) : ?Mailcode_Parser_Safeguard_Placeholder_Locator_Location
100 100
     {
101
-        if(isset($this->instances[$index]))
101
+        if (isset($this->instances[$index]))
102 102
         {
103 103
             return $this->instances[$index];
104 104
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/FormatterLocation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
     */
61 61
     public function getPlaceholderText() : string
62 62
     {
63
-        if($this->requiresAdjustment())
63
+        if ($this->requiresAdjustment())
64 64
         {
65 65
             $text = $this->getAdjustedText();
66 66
             
Please login to merge, or discard this patch.
src/Mailcode/Factory/CommandSets/Set/Misc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.