Passed
Push — master ( 95d9aa...1515ff )
by Sebastian
05:04 queued 13s
created
src/Mailcode/Commands/Command/ShowSnippet.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     {
66 66
         $this->validate();
67 67
         
68
-        if($this->variable instanceof Mailcode_Variables_Variable)
68
+        if ($this->variable instanceof Mailcode_Variables_Variable)
69 69
         {
70 70
             return $this->variable;
71 71
         }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         
96 96
         $var = $info->getVariableByIndex(0);
97 97
         
98
-        if($var)
98
+        if ($var)
99 99
         {
100 100
             $this->variable = $var->getVariable();
101 101
             return;
Please login to merge, or discard this patch.
src/Mailcode/Commands.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     {
47 47
         static $ids = array();
48 48
         
49
-        if(empty($ids)) {
49
+        if (empty($ids)) {
50 50
             $ids = \AppUtils\FileHelper::createFileFinder(__DIR__.'/Commands/Command')
51 51
             ->getPHPClassNames();
52 52
         }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     */
64 64
     public function getAll()
65 65
     {
66
-        if(!empty($this->commands)) {
66
+        if (!empty($this->commands)) {
67 67
             return $this->commands;
68 68
         }
69 69
         
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         
72 72
         $result = array();
73 73
         
74
-        foreach($ids as $id) 
74
+        foreach ($ids as $id) 
75 75
         {
76 76
             $result[] = $this->getDummyCommand($id);
77 77
         }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     {
97 97
         static $instances = array();
98 98
         
99
-        if(!isset($instances[$id])) 
99
+        if (!isset($instances[$id])) 
100 100
         {
101 101
             $instances[$id] = $this->createCommand($id, '__dummy', '', '');
102 102
         }
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
     {
118 118
         $items = $this->getAll();
119 119
         
120
-        foreach($items as $item) 
120
+        foreach ($items as $item) 
121 121
         {
122
-            if($item->getName() === $name) {
122
+            if ($item->getName() === $name) {
123 123
                 return $item->getID();
124 124
             }
125 125
         }
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
     {
152 152
         $items = $this->getAll();
153 153
         
154
-        foreach($items as $item)
154
+        foreach ($items as $item)
155 155
         {
156
-            if($item->getName() === $name) {
156
+            if ($item->getName() === $name) {
157 157
                 return true;
158 158
             }
159 159
         }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
     {
166 166
         $class = $this->resolveClassName($id, $type);
167 167
         
168
-        if(!class_exists($class))
168
+        if (!class_exists($class))
169 169
         {
170 170
             throw new Mailcode_Exception(
171 171
                 'No such command',
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
         
188 188
         $dummy = $this->getDummyCommand($id);
189 189
         
190
-        if($dummy->supportsType())
190
+        if ($dummy->supportsType())
191 191
         {
192
-            if(empty($type))
192
+            if (empty($type))
193 193
             {
194 194
                 $type = $dummy->getDefaultType();
195 195
             }
@@ -209,13 +209,13 @@  discard block
 block discarded – undo
209 209
     */
210 210
     private function getDummyCommand(string $id) : Mailcode_Commands_Command
211 211
     {
212
-        if(!isset(self::$dummyCommands[$id]))
212
+        if (!isset(self::$dummyCommands[$id]))
213 213
         {
214 214
             $class = 'Mailcode\Mailcode_Commands_Command_'.$id;
215 215
             self::$dummyCommands[$id] = new $class('__dummy');
216 216
         }
217 217
         
218
-        if(self::$dummyCommands[$id] instanceof Mailcode_Commands_Command)
218
+        if (self::$dummyCommands[$id] instanceof Mailcode_Commands_Command)
219 219
         {
220 220
             return self::$dummyCommands[$id];
221 221
         }
Please login to merge, or discard this patch.
src/Mailcode/Traits/Commands/IfVariable.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         
54 54
         $var = $info->getVariableByIndex(0);
55 55
         
56
-        if($var !== null)
56
+        if ($var !== null)
57 57
         {
58 58
             $this->variableToken = $var;
59 59
             return;
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         
72 72
         $operand = $info->getOperandByIndex(1);
73 73
         
74
-        if($operand === null)
74
+        if ($operand === null)
75 75
         {
76 76
             $this->validationResult->makeError(
77 77
                 t('No operand sign after the variable name.'),
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             return;
82 82
         }
83 83
         
84
-        if(!$operand->isComparator())
84
+        if (!$operand->isComparator())
85 85
         {
86 86
             $this->validationResult->makeError(
87 87
                 t('The operand sign is not a comparison operand.'),
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         
101 101
         $token = $info->getTokenByIndex(2);
102 102
         
103
-        if($token === null)
103
+        if ($token === null)
104 104
         {
105 105
             $this->validationResult->makeError(
106 106
                 t('Nothing found after the comparison operand.'),
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             return;
111 111
         }
112 112
         
113
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Type_Value)
113
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Type_Value)
114 114
         {
115 115
             $this->valueToken = $token;
116 116
             
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     */
131 131
     public function getVariable() : Mailcode_Variables_Variable
132 132
     {
133
-        if($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable)
133
+        if ($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable)
134 134
         {
135 135
             return $this->variableToken->getVariable();
136 136
         }
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     */
151 151
     public function getComparator() : string
152 152
     {
153
-        if($this->comparisonToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand)
153
+        if ($this->comparisonToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand)
154 154
         {
155 155
             return $this->comparisonToken->getOperand();
156 156
         }
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     */
169 169
     public function getValue() : string
170 170
     {
171
-        if($this->valueToken instanceof Mailcode_Parser_Statement_Tokenizer_Type_Value)
171
+        if ($this->valueToken instanceof Mailcode_Parser_Statement_Tokenizer_Type_Value)
172 172
         {
173 173
             return $this->valueToken->getValue();
174 174
         }
Please login to merge, or discard this patch.
src/Mailcode/Traits/Commands/IfContains.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         
53 53
         $variable = $info->getVariableByIndex(0);
54 54
         
55
-        if($variable !== null)
55
+        if ($variable !== null)
56 56
         {
57 57
             $this->variableToken = $variable;
58 58
             return;
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         // first variant: variable "Search term"
72 72
         $string = $info->getStringLiteralByIndex(1);
73 73
         
74
-        if($string !== null)
74
+        if ($string !== null)
75 75
         {
76 76
             $this->stringToken = $string;
77 77
             return;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         // second variant: variable insensitive: "Search term"
88 88
         $keyword = $info->getKeywordByIndex(1);
89 89
         
90
-        if($keyword === null)
90
+        if ($keyword === null)
91 91
         {
92 92
             $this->validationResult->makeError(
93 93
                 t('Expected a search term or the %1$s keyword after the variable name.', 'insensitive:'),
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             return;
98 98
         }
99 99
         
100
-        if($keyword->getKeyword() !== 'insensitive:')
100
+        if ($keyword->getKeyword() !== 'insensitive:')
101 101
         {
102 102
             $this->validationResult->makeError(
103 103
                 t('Invalid keyword %1$s.', $keyword->getKeyword()).' '.
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         
120 120
         $string = $info->getStringLiteralByIndex(2);
121 121
         
122
-        if($string !== null)
122
+        if ($string !== null)
123 123
         {
124 124
             $this->stringToken = $string;
125 125
             return;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     */
139 139
     public function getVariable() : Mailcode_Variables_Variable
140 140
     {
141
-        if($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable)
141
+        if ($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable)
142 142
         {
143 143
             return $this->variableToken->getVariable();
144 144
         }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     
158 158
     public function getSearchTerm() : string
159 159
     {
160
-        if($this->stringToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral)
160
+        if ($this->stringToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral)
161 161
         {
162 162
             return $this->stringToken->getNormalized();
163 163
         }
Please login to merge, or discard this patch.
src/Mailcode/Collection.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         
100 100
         $errors = $this->errors;
101 101
         
102
-        if(!$result->isValid())
102
+        if (!$result->isValid())
103 103
         {
104 104
             $errors[] = new Mailcode_Collection_Error_Message(
105 105
                 '',
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     {
116 116
         $errors = $this->getErrors();
117 117
         
118
-        if(!empty($errors))
118
+        if (!empty($errors))
119 119
         {
120 120
             return array_shift($errors);
121 121
         }
@@ -157,11 +157,11 @@  discard block
 block discarded – undo
157 157
     {
158 158
         $hashes = array();
159 159
         
160
-        foreach($this->commands as $command)
160
+        foreach ($this->commands as $command)
161 161
         {
162 162
             $hash = $command->getHash();
163 163
             
164
-            if(!isset($hashes[$hash]))
164
+            if (!isset($hashes[$hash]))
165 165
             {
166 166
                 $hashes[$hash] = $command;
167 167
             }
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     */
179 179
     public function addCommands(array $commands) : Mailcode_Collection
180 180
     {
181
-        foreach($commands as $command)
181
+        foreach ($commands as $command)
182 182
         {
183 183
             $this->addCommand($command);
184 184
         }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     {
198 198
         $collection = new Mailcode_Variables_Collection_Regular();
199 199
         
200
-        foreach($this->commands as $command)
200
+        foreach ($this->commands as $command)
201 201
         {
202 202
             $collection->mergeWith($command->getVariables());
203 203
         }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
     
208 208
     public function getValidationResult() : OperationResult
209 209
     {
210
-        if($this->validationResult instanceof OperationResult)
210
+        if ($this->validationResult instanceof OperationResult)
211 211
         {
212 212
             return $this->validationResult;
213 213
         }
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
     {
224 224
         $errors = $this->getErrors();
225 225
         
226
-        foreach($errors as $error)
226
+        foreach ($errors as $error)
227 227
         {
228
-            if($error->getCode() === $code)
228
+            if ($error->getCode() === $code)
229 229
             {
230 230
                 return true;
231 231
             }
@@ -243,9 +243,9 @@  discard block
 block discarded – undo
243 243
     {
244 244
         $result = array();
245 245
         
246
-        foreach($this->commands as $command)
246
+        foreach ($this->commands as $command)
247 247
         {
248
-            if($command instanceof Mailcode_Commands_Command_ShowVariable)
248
+            if ($command instanceof Mailcode_Commands_Command_ShowVariable)
249 249
             {
250 250
                 $result[] = $command;
251 251
             }
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
     {
259 259
         $commands = $this->getCommands();
260 260
         
261
-        if(!empty($commands))
261
+        if (!empty($commands))
262 262
         {
263 263
             return array_shift($commands);
264 264
         }
Please login to merge, or discard this patch.
src/Mailcode/Factory.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      * @param string $formatString A date format string, or empty string for default.
48 48
      * @return Mailcode_Commands_Command_ShowDate
49 49
      */
50
-    public static function showDate(string $variableName, string $formatString="") : Mailcode_Commands_Command_ShowDate
50
+    public static function showDate(string $variableName, string $formatString = "") : Mailcode_Commands_Command_ShowDate
51 51
     {
52 52
         return self::$commandSets->show()->showDate($variableName, $formatString);
53 53
     }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     * 
75 75
     * @see Mailcode_Factory::ERROR_INVALID_COMMAND_CREATED
76 76
     */
77
-    public static function setVar(string $variableName, string $value, bool $quoteValue=true) : Mailcode_Commands_Command_SetVariable
77
+    public static function setVar(string $variableName, string $value, bool $quoteValue = true) : Mailcode_Commands_Command_SetVariable
78 78
     {
79 79
         return self::$commandSets->set()->setVar($variableName, $value, $quoteValue);
80 80
     }
@@ -107,12 +107,12 @@  discard block
 block discarded – undo
107 107
         return self::$commandSets->if()->end();
108 108
     }
109 109
     
110
-    public static function if(string $condition, string $type='') : Mailcode_Commands_Command_If
110
+    public static function if (string $condition, string $type = '') : Mailcode_Commands_Command_If
111 111
     {
112 112
         return self::$commandSets->if()->if($condition, $type);
113 113
     }
114 114
     
115
-    public static function ifVar(string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable
115
+    public static function ifVar(string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If_Variable
116 116
     {
117 117
         return self::$commandSets->if()->ifVar($variable, $operand, $value, $quoteValue);
118 118
     }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         return self::$commandSets->if()->ifVarString($variable, $operand, $value);
123 123
     }
124 124
     
125
-    public static function ifVarEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable
125
+    public static function ifVarEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If_Variable
126 126
     {
127 127
         return self::$commandSets->if()->ifVarEquals($variable, $value, $quoteValue);
128 128
     }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         return self::$commandSets->if()->ifVarEqualsString($variable, $value);
133 133
     }
134 134
     
135
-    public static function ifVarNotEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable
135
+    public static function ifVarNotEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If_Variable
136 136
     {
137 137
         return self::$commandSets->if()->ifVarNotEquals($variable, $value, $quoteValue);
138 138
     }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
         return self::$commandSets->if()->ifVarNotEqualsString($variable, $value);
143 143
     }
144 144
     
145
-    public static function elseIf(string $condition, string $type='') : Mailcode_Commands_Command_ElseIf
145
+    public static function elseIf (string $condition, string $type = '') : Mailcode_Commands_Command_ElseIf
146 146
     {
147 147
         return self::$commandSets->elseIf()->elseIf($condition, $type);
148 148
     }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         return self::$commandSets->elseIf()->elseIfNotEmpty($variable);
158 158
     }
159 159
     
160
-    public static function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable
160
+    public static function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable
161 161
     {
162 162
         return self::$commandSets->elseIf()->elseIfVar($variable, $operand, $value, $quoteValue);
163 163
     }
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
         return self::$commandSets->elseIf()->elseIfVarString($variable, $operand, $value);
168 168
     }
169 169
     
170
-    public static function elseIfVarEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable
170
+    public static function elseIfVarEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable
171 171
     {
172 172
         return self::$commandSets->elseIf()->elseIfVarEquals($variable, $value, $quoteValue);
173 173
     }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         return self::$commandSets->elseIf()->elseIfVarEqualsString($variable, $value);
178 178
     }
179 179
     
180
-    public static function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable
180
+    public static function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable
181 181
     {
182 182
         return self::$commandSets->elseIf()->elseIfVarNotEquals($variable, $value, $quoteValue);
183 183
     }
@@ -187,12 +187,12 @@  discard block
 block discarded – undo
187 187
         return self::$commandSets->elseIf()->elseIfVarNotEqualsString($variable, $value);
188 188
     }
189 189
     
190
-    public static function ifContains(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_Contains
190
+    public static function ifContains(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_Contains
191 191
     {
192 192
         return self::$commandSets->if()->ifContains($variable, $search, $caseInsensitive);
193 193
     }
194 194
     
195
-    public static function elseIfContains(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_Contains
195
+    public static function elseIfContains(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_Contains
196 196
     {
197 197
         return self::$commandSets->elseIf()->elseIfContains($variable, $search, $caseInsensitive);
198 198
     }
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
     
243 243
     public static function init() : void
244 244
     {
245
-        if(!isset(self::$commandSets))
245
+        if (!isset(self::$commandSets))
246 246
         {
247 247
             self::$commandSets = new Mailcode_Factory_CommandSets();
248 248
         }
Please login to merge, or discard this patch.
src/Mailcode/Traits/Commands/IfNotEmpty.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         
42 42
         $variable = $info->getVariableByIndex(0);
43 43
         
44
-        if($variable !== null)
44
+        if ($variable !== null)
45 45
         {
46 46
             $this->variableToken = $variable;
47 47
             return;
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     */
61 61
     public function getVariable() : Mailcode_Variables_Variable
62 62
     {
63
-        if($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable)
63
+        if ($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable)
64 64
         {
65 65
             return $this->variableToken->getVariable();
66 66
         }
Please login to merge, or discard this patch.
src/Mailcode/Factory/CommandSets/Set.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
         
42 42
         $this->instantiator->checkCommand($cmd);
43 43
         
44
-        if($cmd instanceof Mailcode_Commands_Command_End)
44
+        if ($cmd instanceof Mailcode_Commands_Command_End)
45 45
         {
46 46
             return $cmd;
47 47
         }
Please login to merge, or discard this patch.
src/Mailcode/Factory/CommandSets/IfBase.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
         
32 32
         $this->instantiator->checkCommand($cmd);
33 33
         
34
-        if($cmd instanceof Mailcode_Commands_Command_Else)
34
+        if ($cmd instanceof Mailcode_Commands_Command_Else)
35 35
         {
36 36
             return $cmd;
37 37
         }
Please login to merge, or discard this patch.