Passed
Push — master ( 95d9aa...1515ff )
by Sebastian
05:04 queued 13s
created
src/Mailcode/Parser/Safeguard/Formatter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         $lastPos = 0;
49 49
         $positions = array();
50 50
         
51
-        while (($lastPos = mb_strpos($haystack, $needle, $lastPos))!== false)
51
+        while (($lastPos = mb_strpos($haystack, $needle, $lastPos)) !== false)
52 52
         {
53 53
             $positions[] = $lastPos;
54 54
             $lastPos = $lastPos + mb_strlen($needle);
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     {
68 68
         $eol = ConvertHelper::detectEOLCharacter($subject);
69 69
         
70
-        if($eol)
70
+        if ($eol)
71 71
         {
72 72
             return $eol->getCharacter();
73 73
         }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         
89 89
         $result = array();
90 90
         
91
-        foreach($placeholders as $placeholder)
91
+        foreach ($placeholders as $placeholder)
92 92
         {
93 93
             $result[] = $placeholder->getReplacementText();
94 94
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/Formatter/SingleLines/Placeholder.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -90,21 +90,21 @@  discard block
 block discarded – undo
90 90
     protected function analyzePrepend(string $subject) : void
91 91
     {
92 92
         // we're at the beginning of the string
93
-        if($this->position == 0)
93
+        if ($this->position == 0)
94 94
         {
95 95
             return;
96 96
         }
97 97
         
98 98
         $prevPos = $this->position - $this->eolLength;
99 99
         
100
-        if($prevPos < 0)
100
+        if ($prevPos < 0)
101 101
         {
102 102
             $prevPos = 0;
103 103
         }
104 104
         
105 105
         $prev = mb_substr($subject, $prevPos, $this->eolLength);
106 106
         
107
-        if($prev !== $this->formatter->getEOLChar())
107
+        if ($prev !== $this->formatter->getEOLChar())
108 108
         {
109 109
             $this->prepend = true;
110 110
         }
@@ -117,21 +117,21 @@  discard block
 block discarded – undo
117 117
         $position = $this->position + $this->placeholderLength;
118 118
         
119 119
         // we're at the end of the string
120
-        if($position >= $subjectLength)
120
+        if ($position >= $subjectLength)
121 121
         {
122 122
             return;
123 123
         }
124 124
         
125 125
         $nextPos = $position + $this->eolLength;
126 126
         
127
-        if($nextPos > $subjectLength)
127
+        if ($nextPos > $subjectLength)
128 128
         {
129 129
             $nextPos = $subjectLength - $this->eolLength;
130 130
         }
131 131
         
132 132
         $next = mb_substr($subject, $nextPos, $this->eolLength);
133 133
         
134
-        if($next !== $this->formatter->getEOLChar())
134
+        if ($next !== $this->formatter->getEOLChar())
135 135
         {
136 136
             $this->append = true;
137 137
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/Formatter/SingleLines.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         
43 43
         $total = count($placeholders);
44 44
         
45
-        for($i=0; $i < $total; $i++)
45
+        for ($i = 0; $i < $total; $i++)
46 46
         {
47 47
             $subject = $this->process($placeholders[$i], $subject);
48 48
         }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $phLength = mb_strlen($placeholder);
67 67
         $offset = 0;
68 68
         
69
-        foreach($positions as $position)
69
+        foreach ($positions as $position)
70 70
         {
71 71
             // adjust the position if previous changes made the subject longer
72 72
             $position += $offset;
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
                 $position
79 79
             );
80 80
             
81
-            if(!$info->requiresAdjustment())
81
+            if (!$info->requiresAdjustment())
82 82
             {
83 83
                 continue;
84 84
             }
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
         $prepend = '';
107 107
         $append = '';
108 108
         
109
-        if($info->requiresPrepend())
109
+        if ($info->requiresPrepend())
110 110
         {
111 111
             $prepend = $this->eol;
112 112
         }
113 113
         
114
-        if($info->requiresAppend())
114
+        if ($info->requiresAppend())
115 115
         {
116 116
             $append = $this->eol;
117 117
         }
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
         
133 133
         $result = array();
134 134
         
135
-        foreach($placeholders as $placeholder)
135
+        foreach ($placeholders as $placeholder)
136 136
         {
137
-            if(!$placeholder->getCommand()->generatesContent())
137
+            if (!$placeholder->getCommand()->generatesContent())
138 138
             {
139 139
                 $result[] = $placeholder;
140 140
             }
Please login to merge, or discard this patch.
src/Mailcode/Translator/Syntax/ApacheVelocity/ShowDate.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,9 +56,9 @@
 block discarded – undo
56 56
         $chars = ConvertHelper::string2array($formatString);
57 57
         $result = array();
58 58
         
59
-        foreach($chars as $char)
59
+        foreach ($chars as $char)
60 60
         {
61
-            if(!isset($this->charTable[$char]))
61
+            if (!isset($this->charTable[$char]))
62 62
             {
63 63
                 throw new Mailcode_Translator_Exception(
64 64
                     'Unknown date format string character',
Please login to merge, or discard this patch.
src/Mailcode/Date/FormatInfo/Character.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@
 block discarded – undo
87 87
     */
88 88
     public function getTypeLabel() : string
89 89
     {
90
-        switch($this->type)
90
+        switch ($this->type)
91 91
         {
92 92
             case Mailcode_Date_FormatInfo::CHARTYPE_DATE:
93 93
                 return t('Date');
Please login to merge, or discard this patch.
src/Mailcode/Date/FormatInfo.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     
59 59
     public static function getInstance() : Mailcode_Date_FormatInfo
60 60
     {
61
-        if(!isset(self::$instance))
61
+        if (!isset(self::$instance))
62 62
         {
63 63
             self::$instance = new Mailcode_Date_FormatInfo();
64 64
         }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
             array(self::CHARTYPE_PUNCTUATION, ' ', t('Space'))
91 91
         );
92 92
         
93
-        foreach($chars as $def)
93
+        foreach ($chars as $def)
94 94
         {
95 95
             $char = new Mailcode_Date_FormatInfo_Character(
96 96
                 $def[0],
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         
130 130
         $trimmed = trim($formatString);
131 131
         
132
-        if(empty($trimmed))
132
+        if (empty($trimmed))
133 133
         {
134 134
             $result->makeError(
135 135
                 t('Empty date format.'),
@@ -142,15 +142,15 @@  discard block
 block discarded – undo
142 142
         $chars = ConvertHelper::string2array($formatString);
143 143
         $total = count($chars);
144 144
         
145
-        for($i=0; $i < $total; $i++)
145
+        for ($i = 0; $i < $total; $i++)
146 146
         {
147 147
             $char = $chars[$i];
148 148
             
149
-            if(!in_array($char, $this->allowedChars))
149
+            if (!in_array($char, $this->allowedChars))
150 150
             {
151 151
                 $result->makeError(
152 152
                     t('Invalid character in date format:').' '.
153
-                    t('%1$s at position %2$s.', '<code>'.$char.'</code>', $i+1),
153
+                    t('%1$s at position %2$s.', '<code>'.$char.'</code>', $i + 1),
154 154
                     self::VALIDATION_INVALID_FORMAT_CHARACTER
155 155
                 );
156 156
                 
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
     {
183 183
         $grouped = array();
184 184
         
185
-        foreach($this->formatChars as $char)
185
+        foreach ($this->formatChars as $char)
186 186
         {
187 187
             $type = $char->getTypeLabel();
188 188
             
189
-            if(!isset($grouped[$type]))
189
+            if (!isset($grouped[$type]))
190 190
             {
191 191
                 $grouped[$type] = array();
192 192
             }
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
         $groups = array_keys($grouped);
198 198
         
199
-        foreach($groups as $group)
199
+        foreach ($groups as $group)
200 200
         {
201 201
             usort($grouped[$group], function(Mailcode_Date_FormatInfo_Character $a, Mailcode_Date_FormatInfo_Character $b)
202 202
             {
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Info.php 1 patch
Spacing   +11 added lines, -11 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
             }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     {
108 108
         $token = $this->getTokenByIndex($index);
109 109
         
110
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable)
110
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable)
111 111
         {
112 112
             return $token;
113 113
         }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
     {
128 128
         $token = $this->getTokenByIndex($index);
129 129
         
130
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral)
130
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral)
131 131
         {
132 132
             return $token;
133 133
         }
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     {
148 148
         $token = $this->getTokenByIndex($index);
149 149
         
150
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
150
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
151 151
         {
152 152
             return $token;
153 153
         }
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
     {
168 168
         $token = $this->getTokenByIndex($index);
169 169
         
170
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand)
170
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand)
171 171
         {
172 172
             return $token;
173 173
         }
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
     */
186 186
     public function getTokenByIndex(int $index) : ?Mailcode_Parser_Statement_Tokenizer_Token
187 187
     {
188
-        if(isset($this->tokens[$index]))
188
+        if (isset($this->tokens[$index]))
189 189
         {
190 190
             return $this->tokens[$index];
191 191
         }
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
     {
207 207
         $result = array();
208 208
         
209
-        foreach($this->tokens as $token)
209
+        foreach ($this->tokens as $token)
210 210
         {
211
-            if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral)
211
+            if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral)
212 212
             {
213 213
                 $result[] = $token;
214 214
             }
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command/ShowDate.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,18 +56,18 @@
 block discarded – undo
56 56
          $token = $this->params->getInfo()->getTokenByIndex(1);
57 57
          
58 58
          // no format specified? Use the default one.
59
-         if($token === null)
59
+         if ($token === null)
60 60
          {
61 61
              return;
62 62
          }
63 63
          
64
-         if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral)
64
+         if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral)
65 65
          {
66 66
              $format = $token->getText();
67 67
              
68 68
              $result = $this->formatInfo->validateFormat($format);
69 69
              
70
-             if($result->isValid())
70
+             if ($result->isValid())
71 71
              {
72 72
                 $this->formatString = $format;
73 73
              }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     
76 76
     public function getInfo() : Mailcode_Parser_Statement_Info
77 77
     {
78
-        if($this->info instanceof Mailcode_Parser_Statement_Info)
78
+        if ($this->info instanceof Mailcode_Parser_Statement_Info)
79 79
         {
80 80
             return $this->info; 
81 81
         }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     
88 88
     protected function validate() : void
89 89
     {
90
-        if(!$this->tokenizer->hasTokens())
90
+        if (!$this->tokenizer->hasTokens())
91 91
         {
92 92
             $this->result->makeError(
93 93
                 t('Empty statement'),
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         
100 100
         $unknown = $this->tokenizer->getFirstUnknown();
101 101
         
102
-        if($unknown)
102
+        if ($unknown)
103 103
         {
104 104
             $this->result->makeError(
105 105
                t('Unquoted string literal found:').' ('.htmlspecialchars($unknown->getMatchedText()).')',
Please login to merge, or discard this patch.