Passed
Push — master ( f9e497...77f2a3 )
by Sebastian
02:55
created
src/Mailcode/Factory/CommandSets/Set/Show.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         
34 34
         $this->instantiator->checkCommand($cmd);
35 35
         
36
-        if($cmd instanceof Mailcode_Commands_Command_ShowVariable)
36
+        if ($cmd instanceof Mailcode_Commands_Command_ShowVariable)
37 37
         {
38 38
             return $cmd;
39 39
         }
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
         throw $this->instantiator->exceptionUnexpectedType('ShowVariable', $cmd);
42 42
     }
43 43
     
44
-    public function showDate(string $variableName, string $formatString="") : Mailcode_Commands_Command_ShowDate
44
+    public function showDate(string $variableName, string $formatString = "") : Mailcode_Commands_Command_ShowDate
45 45
     {
46 46
         $variableName = $this->instantiator->filterVariableName($variableName);
47 47
         
48 48
         $format = '';
49
-        if(!empty($formatString))
49
+        if (!empty($formatString))
50 50
         {
51 51
             $format = sprintf(
52 52
                 ' "%s"',
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         
68 68
         $this->instantiator->checkCommand($cmd);
69 69
         
70
-        if($cmd instanceof Mailcode_Commands_Command_ShowDate)
70
+        if ($cmd instanceof Mailcode_Commands_Command_ShowDate)
71 71
         {
72 72
             return $cmd;
73 73
         }
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
         throw $this->instantiator->exceptionUnexpectedType('ShowDate', $cmd);
76 76
     }
77 77
 
78
-    public function showNumber(string $variableName, string $formatString="") : Mailcode_Commands_Command_ShowNumber
78
+    public function showNumber(string $variableName, string $formatString = "") : Mailcode_Commands_Command_ShowNumber
79 79
     {
80 80
         $variableName = $this->instantiator->filterVariableName($variableName);
81 81
 
82 82
         $format = '';
83
-        if(!empty($formatString))
83
+        if (!empty($formatString))
84 84
         {
85 85
             $format = sprintf(
86 86
                 ' "%s"',
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 
102 102
         $this->instantiator->checkCommand($cmd);
103 103
 
104
-        if($cmd instanceof Mailcode_Commands_Command_ShowNumber)
104
+        if ($cmd instanceof Mailcode_Commands_Command_ShowNumber)
105 105
         {
106 106
             return $cmd;
107 107
         }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         
123 123
         $this->instantiator->checkCommand($cmd);
124 124
         
125
-        if($cmd instanceof Mailcode_Commands_Command_ShowSnippet)
125
+        if ($cmd instanceof Mailcode_Commands_Command_ShowSnippet)
126 126
         {
127 127
             return $cmd;
128 128
         }
Please login to merge, or discard this patch.
src/Mailcode/Factory/CommandSets/Set/ElseIf.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -20,11 +20,11 @@  discard block
 block discarded – undo
20 20
  */
21 21
 class Mailcode_Factory_CommandSets_Set_ElseIf extends Mailcode_Factory_CommandSets_IfBase
22 22
 {
23
-    public function elseIf(string $condition, string $type='') : Mailcode_Commands_Command_ElseIf
23
+    public function elseIf (string $condition, string $type = '') : Mailcode_Commands_Command_ElseIf
24 24
     {
25 25
         $command = $this->instantiator->buildIf('ElseIf', $condition, $type);
26 26
         
27
-        if($command instanceof Mailcode_Commands_Command_ElseIf)
27
+        if ($command instanceof Mailcode_Commands_Command_ElseIf)
28 28
         {
29 29
             return $command;
30 30
         }
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
         throw $this->instantiator->exceptionUnexpectedType('ElseIf', $command);
33 33
     }
34 34
     
35
-    public function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable
35
+    public function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable
36 36
     {
37 37
         $command = $this->instantiator->buildIfVar('ElseIf', $variable, $operand, $value, $quoteValue);
38 38
         
39
-        if($command instanceof Mailcode_Commands_Command_ElseIf_Variable)
39
+        if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable)
40 40
         {
41 41
             return $command;
42 42
         }
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     {
49 49
         $command = $this->instantiator->buildIfVar('ElseIf', $variable, $operand, $value, true);
50 50
         
51
-        if($command instanceof Mailcode_Commands_Command_ElseIf_Variable)
51
+        if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable)
52 52
         {
53 53
             return $command;
54 54
         }
@@ -56,11 +56,11 @@  discard block
 block discarded – undo
56 56
         throw $this->instantiator->exceptionUnexpectedType('ElseIfVarString', $command);
57 57
     }
58 58
     
59
-    public function elseIfVarEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable
59
+    public function elseIfVarEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable
60 60
     {
61 61
         $command = $this->instantiator->buildIfVar('ElseIf', $variable, '==', $value, $quoteValue);
62 62
         
63
-        if($command instanceof Mailcode_Commands_Command_ElseIf_Variable)
63
+        if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable)
64 64
         {
65 65
             return $command;
66 66
         }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     {
73 73
         $command = $this->instantiator->buildIfVar('ElseIf', $variable, '==', $value, true);
74 74
         
75
-        if($command instanceof Mailcode_Commands_Command_ElseIf_Variable)
75
+        if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable)
76 76
         {
77 77
             return $command;
78 78
         }
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
         throw $this->instantiator->exceptionUnexpectedType('ElseIfVarEqualsString', $command);
81 81
     }
82 82
     
83
-    public function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable
83
+    public function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable
84 84
     {
85 85
         $command = $this->instantiator->buildIfVar('ElseIf', $variable, '!=', $value, $quoteValue);
86 86
         
87
-        if($command instanceof Mailcode_Commands_Command_ElseIf_Variable)
87
+        if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable)
88 88
         {
89 89
             return $command;
90 90
         }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     {
97 97
         $command = $this->instantiator->buildIfVar('ElseIf', $variable, '!=', $value, true);
98 98
         
99
-        if($command instanceof Mailcode_Commands_Command_ElseIf_Variable)
99
+        if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable)
100 100
         {
101 101
             return $command;
102 102
         }
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
     * @param bool $caseInsensitive
111 111
     * @return Mailcode_Commands_Command_ElseIf_Contains
112 112
     */
113
-    public function elseIfContains(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_Contains
113
+    public function elseIfContains(string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_Contains
114 114
     {
115 115
         $command = $this->instantiator->buildIfContains('ElseIf', $variable, $searchTerms, $caseInsensitive);
116 116
         
117
-        if($command instanceof Mailcode_Commands_Command_ElseIf_Contains)
117
+        if ($command instanceof Mailcode_Commands_Command_ElseIf_Contains)
118 118
         {
119 119
             return $command;
120 120
         }
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
         throw $this->instantiator->exceptionUnexpectedType('ElseIfContains', $command);
123 123
     }
124 124
     
125
-    public function elseIfBeginsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_BeginsWith
125
+    public function elseIfBeginsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_BeginsWith
126 126
     {
127 127
         $command = $this->instantiator->buildIfBeginsWith('ElseIf', $variable, $search, $caseInsensitive);
128 128
         
129
-        if($command instanceof Mailcode_Commands_Command_ElseIf_BeginsWith)
129
+        if ($command instanceof Mailcode_Commands_Command_ElseIf_BeginsWith)
130 130
         {
131 131
             return $command;
132 132
         }
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
         throw $this->instantiator->exceptionUnexpectedType('ElseIfBeginsWith', $command);
135 135
     }
136 136
     
137
-    public function elseIfEndsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_EndsWith
137
+    public function elseIfEndsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_EndsWith
138 138
     {
139 139
         $command = $this->instantiator->buildIfEndsWith('ElseIf', $variable, $search, $caseInsensitive);
140 140
         
141
-        if($command instanceof Mailcode_Commands_Command_ElseIf_EndsWith)
141
+        if ($command instanceof Mailcode_Commands_Command_ElseIf_EndsWith)
142 142
         {
143 143
             return $command;
144 144
         }
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     {
151 151
         $command = $this->instantiator->buildIfEmpty('ElseIf', $variable);
152 152
         
153
-        if($command instanceof Mailcode_Commands_Command_ElseIf_Empty)
153
+        if ($command instanceof Mailcode_Commands_Command_ElseIf_Empty)
154 154
         {
155 155
             return $command;
156 156
         }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     {
163 163
         $command = $this->instantiator->buildIfNotEmpty('ElseIf', $variable);
164 164
         
165
-        if($command instanceof Mailcode_Commands_Command_ElseIf_NotEmpty)
165
+        if ($command instanceof Mailcode_Commands_Command_ElseIf_NotEmpty)
166 166
         {
167 167
             return $command;
168 168
         }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     {
175 175
         $command = $this->instantiator->buildIfBiggerThan('ElseIf', $variable, $value);
176 176
 
177
-        if($command instanceof Mailcode_Commands_Command_ElseIf_BiggerThan)
177
+        if ($command instanceof Mailcode_Commands_Command_ElseIf_BiggerThan)
178 178
         {
179 179
             return $command;
180 180
         }
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     {
187 187
         $command = $this->instantiator->buildIfSmallerThan('ElseIf', $variable, $value);
188 188
 
189
-        if($command instanceof Mailcode_Commands_Command_ElseIf_SmallerThan)
189
+        if ($command instanceof Mailcode_Commands_Command_ElseIf_SmallerThan)
190 190
         {
191 191
             return $command;
192 192
         }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
     {
199 199
         $command = $this->instantiator->buildIfEquals('ElseIf', $variable, $value);
200 200
 
201
-        if($command instanceof Mailcode_Commands_Command_ElseIf_EqualsNumber)
201
+        if ($command instanceof Mailcode_Commands_Command_ElseIf_EqualsNumber)
202 202
         {
203 203
             return $command;
204 204
         }
Please login to merge, or discard this patch.
src/Mailcode/Traits/Commands/IfNumber.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
     {
51 51
         $value = $this->getRawNumber();
52 52
 
53
-        if(!is_numeric($value))
53
+        if (!is_numeric($value))
54 54
         {
55 55
             $this->validationResult->makeError(
56 56
                 t(
Please login to merge, or discard this patch.
src/Mailcode/Translator/Syntax.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
             $command->getID()
65 65
         );
66 66
         
67
-        if(!class_exists($class))
67
+        if (!class_exists($class))
68 68
         {
69 69
             throw new Mailcode_Translator_Exception(
70 70
                 sprintf('Unknown command %s in translator', $command->getID()),
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     {
93 93
         $subject = $safeguard->makeSafe();
94 94
         
95
-        if(!$safeguard->hasPlaceholders())
95
+        if (!$safeguard->hasPlaceholders())
96 96
         {
97 97
             return $subject;
98 98
         }
@@ -101,13 +101,13 @@  discard block
 block discarded – undo
101 101
         
102 102
         $replaces = array();
103 103
         
104
-        foreach($placeholders as $placeholder)
104
+        foreach ($placeholders as $placeholder)
105 105
         {
106 106
             $command = $placeholder->getCommand();
107 107
 
108 108
             $replaces[$placeholder->getReplacementText()] = $this->translateCommand($command);
109 109
 
110
-            if($command instanceof Mailcode_Interfaces_Commands_ProtectedContent)
110
+            if ($command instanceof Mailcode_Interfaces_Commands_ProtectedContent)
111 111
             {
112 112
                 $replaces[$command->getContentPlaceholder()] = $command->getContent();
113 113
             }
Please login to merge, or discard this patch.
src/Mailcode/Translator/Syntax/ApacheVelocity/ShowVariable.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         $varName = ltrim($command->getVariableName(), '$');
26 26
 
27 27
         // Automatically URL escape the variable if it's in an URL.
28
-        if($command->isURLEncoded())
28
+        if ($command->isURLEncoded())
29 29
         {
30 30
             return sprintf(
31 31
                 '${esc.url($%s)}',
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
             );
34 34
         }
35 35
 
36
-        if($command->isURLDecoded())
36
+        if ($command->isURLDecoded())
37 37
         {
38 38
             return sprintf(
39 39
                 '${esc.unurl($%s)}',
Please login to merge, or discard this patch.
src/Mailcode/Translator/Syntax/ApacheVelocity/Base/AbstractIf.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         // IF type.
40 40
         $method = 'translate'.$this->getIfType($command);
41 41
 
42
-        if(method_exists($this, $method))
42
+        if (method_exists($this, $method))
43 43
         {
44 44
             return strval($this->$method($command));
45 45
         }
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
         
54 54
         $keywords = $command->getLogicKeywords()->getKeywords();
55 55
         
56
-        foreach($keywords as $keyword)
56
+        foreach ($keywords as $keyword)
57 57
         {
58 58
             $keyCommand = $keyword->getCommand();
59 59
             
60
-            if($keyCommand instanceof Mailcode_Commands_IfBase)
60
+            if ($keyCommand instanceof Mailcode_Commands_IfBase)
61 61
             {
62 62
                 $body .= ' '.$this->getSign($keyword).' '.$this->translateBody($keyCommand);
63 63
             }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     
81 81
     protected function getSign(Mailcode_Commands_LogicKeywords_Keyword $keyword) : string
82 82
     {
83
-        switch($keyword->getName())
83
+        switch ($keyword->getName())
84 84
         {
85 85
             case 'and':
86 86
                 return '&&';
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     {
118 118
         $sign = '';
119 119
         
120
-        if($notEmpty)
120
+        if ($notEmpty)
121 121
         {
122 122
             $sign = '!';
123 123
         }
@@ -133,12 +133,12 @@  discard block
 block discarded – undo
133 133
     {
134 134
         $params = $command->getParams();
135 135
 
136
-        if(!$params)
136
+        if (!$params)
137 137
         {
138 138
             return '';
139 139
         }
140 140
 
141
-        if($command->hasFreeformParameters())
141
+        if ($command->hasFreeformParameters())
142 142
         {
143 143
             return $params->getStatementString();
144 144
         }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         $test = strtolower(trim($value, '"'));
152 152
         $fullName = $variable->getFullName();
153 153
 
154
-        if(in_array($test, array('true', 'false')))
154
+        if (in_array($test, array('true', 'false')))
155 155
         {
156 156
             $fullName .= '.toLowerCase()';
157 157
             $value = '"'.$test.'"';
@@ -178,12 +178,12 @@  discard block
 block discarded – undo
178 178
         $varName = $variable->getFullName();
179 179
 
180 180
         $opts = 's';
181
-        if($caseSensitive)
181
+        if ($caseSensitive)
182 182
         {
183 183
             $opts = 'is';
184 184
         }
185 185
         
186
-        foreach($searchTerms as $token)
186
+        foreach ($searchTerms as $token)
187 187
         {
188 188
             $parts[] = sprintf(
189 189
                 '%s.matches("(?%s)%s")',
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     protected function _translateSearch(string $mode, Mailcode_Variables_Variable $variable, bool $caseSensitive, string $searchTerm) : string
200 200
     {
201 201
         $method = $mode.'With';
202
-        if($caseSensitive)
202
+        if ($caseSensitive)
203 203
         {
204 204
             $method = $mode.'WithIgnoreCase';
205 205
         }
Please login to merge, or discard this patch.
src/Mailcode/Translator/Syntax/ApacheVelocity/ShowSnippet.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
             $varName
35 35
         );
36 36
 
37
-        if($command->isURLEncoded())
37
+        if ($command->isURLEncoded())
38 38
         {
39 39
             return sprintf(
40 40
                 '${esc.url($%s)}',
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
             );
43 43
         }
44 44
 
45
-        if($command->isURLDecoded())
45
+        if ($command->isURLDecoded())
46 46
         {
47 47
             return sprintf(
48 48
                 '${esc.unurl($%s)}',
Please login to merge, or discard this patch.
src/Mailcode/Translator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function createSyntax(string $name) : Mailcode_Translator_Syntax
34 34
     {
35
-        if($this->syntaxExists($name))
35
+        if ($this->syntaxExists($name))
36 36
         {
37 37
             return new Mailcode_Translator_Syntax($name);
38 38
         }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         $names = $this->getSyntaxNames();
60 60
         $result = array();
61 61
 
62
-        foreach($names as $name)
62
+        foreach ($names as $name)
63 63
         {
64 64
             $result[] = $this->createSyntax($name);
65 65
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      */
52 52
     protected $freeform = false;
53 53
 
54
-    public function __construct(string $statement, bool $freeform=false)
54
+    public function __construct(string $statement, bool $freeform = false)
55 55
     {
56 56
         $this->statement = $statement;
57 57
         $this->result = new OperationResult($this);
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     
81 81
     public function getInfo() : Mailcode_Parser_Statement_Info
82 82
     {
83
-        if($this->info instanceof Mailcode_Parser_Statement_Info)
83
+        if ($this->info instanceof Mailcode_Parser_Statement_Info)
84 84
         {
85 85
             return $this->info; 
86 86
         }
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
     
93 93
     protected function validate() : void
94 94
     {
95
-        if($this->freeform)
95
+        if ($this->freeform)
96 96
         {
97 97
             return;
98 98
         }
99 99
 
100
-        if(!$this->tokenizer->hasTokens())
100
+        if (!$this->tokenizer->hasTokens())
101 101
         {
102 102
             $this->result->makeError(
103 103
                 t('Empty statement'),
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         
110 110
         $unknown = $this->tokenizer->getFirstUnknown();
111 111
         
112
-        if($unknown)
112
+        if ($unknown)
113 113
         {
114 114
             $this->result->makeError(
115 115
                t('Unquoted string literal found:').' ('.htmlspecialchars($unknown->getMatchedText()).')',
Please login to merge, or discard this patch.