Passed
Push — master ( 1c67eb...daf615 )
by Sebastian
02:12
created
src/Mailcode/Collection.php 2 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
  */
23 23
 class Mailcode_Collection
24 24
 {
25
-   /**
26
-    * @var Mailcode_Commands_Command[]
27
-    */
25
+    /**
26
+     * @var Mailcode_Commands_Command[]
27
+     */
28 28
     protected $commands = array();
29 29
     
30 30
     /**
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
      */
33 33
     protected $errors = array();
34 34
     
35
-   /**
36
-    * @var OperationResult|NULL
37
-    */
35
+    /**
36
+     * @var OperationResult|NULL
37
+     */
38 38
     protected $validationResult;
39 39
     
40
-   /**
41
-    * Adds a command to the collection.
42
-    * 
43
-    * @param Mailcode_Commands_Command $command
44
-    * @return Mailcode_Collection
45
-    */
40
+    /**
41
+     * Adds a command to the collection.
42
+     * 
43
+     * @param Mailcode_Commands_Command $command
44
+     * @return Mailcode_Collection
45
+     */
46 46
     public function addCommand(Mailcode_Commands_Command $command) : Mailcode_Collection
47 47
     {
48 48
         $this->commands[] = $command;
@@ -54,21 +54,21 @@  discard block
 block discarded – undo
54 54
         return $this;
55 55
     }
56 56
     
57
-   /**
58
-    * Whether there are any commands in the collection.
59
-    * 
60
-    * @return bool
61
-    */
57
+    /**
58
+     * Whether there are any commands in the collection.
59
+     * 
60
+     * @return bool
61
+     */
62 62
     public function hasCommands() : bool
63 63
     {
64 64
         return !empty($this->commands);
65 65
     }
66 66
     
67
-   /**
68
-    * Counts the amount of commands in the collection.
69
-    * 
70
-    * @return int
71
-    */
67
+    /**
68
+     * Counts the amount of commands in the collection.
69
+     * 
70
+     * @return int
71
+     */
72 72
     public function countCommands() : int
73 73
     {
74 74
         return count($this->commands);
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
         $this->errors[] = new Mailcode_Collection_Error_Command($command);
89 89
     }
90 90
     
91
-   /**
92
-    * @return Mailcode_Collection_Error[]
93
-    */
91
+    /**
92
+     * @return Mailcode_Collection_Error[]
93
+     */
94 94
     public function getErrors()
95 95
     {
96 96
         $result = $this->getValidationResult();
@@ -116,25 +116,25 @@  discard block
 block discarded – undo
116 116
         return empty($errors);
117 117
     }
118 118
     
119
-   /**
120
-    * Retrieves all commands that were detected, in the exact order
121
-    * they were found.
122
-    * 
123
-    * @return \Mailcode\Mailcode_Commands_Command[]
124
-    */
119
+    /**
120
+     * Retrieves all commands that were detected, in the exact order
121
+     * they were found.
122
+     * 
123
+     * @return \Mailcode\Mailcode_Commands_Command[]
124
+     */
125 125
     public function getCommands()
126 126
     {
127
-       return $this->commands;
127
+        return $this->commands;
128 128
     }
129 129
     
130
-   /**
131
-    * Retrieves all unique commands by their matched
132
-    * string hash: this ensures only commands that were
133
-    * written the exact same way (including spacing)
134
-    * are returned.
135
-    * 
136
-    * @return \Mailcode\Mailcode_Commands_Command[]
137
-    */
130
+    /**
131
+     * Retrieves all unique commands by their matched
132
+     * string hash: this ensures only commands that were
133
+     * written the exact same way (including spacing)
134
+     * are returned.
135
+     * 
136
+     * @return \Mailcode\Mailcode_Commands_Command[]
137
+     */
138 138
     public function getGroupedByHash()
139 139
     {
140 140
         $hashes = array();
@@ -152,12 +152,12 @@  discard block
 block discarded – undo
152 152
         return array_values($hashes);
153 153
     }
154 154
 
155
-   /**
156
-    * Adds several commands at once.
157
-    * 
158
-    * @param Mailcode_Commands_Command[] $commands
159
-    * @return Mailcode_Collection
160
-    */
155
+    /**
156
+     * Adds several commands at once.
157
+     * 
158
+     * @param Mailcode_Commands_Command[] $commands
159
+     * @return Mailcode_Collection
160
+     */
161 161
     public function addCommands(array $commands) : Mailcode_Collection
162 162
     {
163 163
         foreach($commands as $command)
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
         return false;
217 217
     }
218 218
     
219
-   /**
220
-    * Retrieves only show variable commands in the collection, if any.
221
-    * 
222
-    * @return \Mailcode\Mailcode_Commands_Command_ShowVariable[]
223
-    */
219
+    /**
220
+     * Retrieves only show variable commands in the collection, if any.
221
+     * 
222
+     * @return \Mailcode\Mailcode_Commands_Command_ShowVariable[]
223
+     */
224 224
     public function getShowVariableCommands()
225 225
     {
226 226
         $result = array();
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         
98 98
         $errors = $this->errors;
99 99
         
100
-        if(!$result->isValid())
100
+        if (!$result->isValid())
101 101
         {
102 102
             $errors[] = new Mailcode_Collection_Error_Message(
103 103
                 '',
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
     {
140 140
         $hashes = array();
141 141
         
142
-        foreach($this->commands as $command)
142
+        foreach ($this->commands as $command)
143 143
         {
144 144
             $hash = $command->getHash();
145 145
             
146
-            if(!isset($hashes[$hash]))
146
+            if (!isset($hashes[$hash]))
147 147
             {
148 148
                 $hashes[$hash] = $command;
149 149
             }
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
     */
161 161
     public function addCommands(array $commands) : Mailcode_Collection
162 162
     {
163
-        foreach($commands as $command)
163
+        foreach ($commands as $command)
164 164
         {
165 165
             $this->addCommand($command);
166 166
         }
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     {
180 180
         $collection = new Mailcode_Variables_Collection_Regular();
181 181
         
182
-        foreach($this->commands as $command)
182
+        foreach ($this->commands as $command)
183 183
         {
184 184
             $collection->mergeWith($command->getVariables());
185 185
         }
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     
190 190
     public function getValidationResult() : OperationResult
191 191
     {
192
-        if(isset($this->validationResult))
192
+        if (isset($this->validationResult))
193 193
         {
194 194
             return $this->validationResult;
195 195
         }
@@ -205,9 +205,9 @@  discard block
 block discarded – undo
205 205
     {
206 206
         $errors = $this->getErrors();
207 207
         
208
-        foreach($errors as $error)
208
+        foreach ($errors as $error)
209 209
         {
210
-            if($error->getCode() === $code)
210
+            if ($error->getCode() === $code)
211 211
             {
212 212
                 return true;
213 213
             }
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
     {
226 226
         $result = array();
227 227
         
228
-        foreach($this->commands as $command)
228
+        foreach ($this->commands as $command)
229 229
         {
230
-            if($command instanceof Mailcode_Commands_Command_ShowVariable)
230
+            if ($command instanceof Mailcode_Commands_Command_ShowVariable)
231 231
             {
232 232
                 $result[] = $command;
233 233
             }
Please login to merge, or discard this patch.
src/Mailcode/Renderer.php 3 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -21,17 +21,17 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class Mailcode_Renderer
23 23
 {
24
-   /**
25
-    * @var boolean
26
-    */
24
+    /**
25
+     * @var boolean
26
+     */
27 27
     protected $highlighted = false;
28 28
     
29
-   /**
30
-    * Sets whether to output highlighted commands instead of the default plain text.
31
-    * 
32
-    * @param bool $highlighted
33
-    * @return Mailcode_Renderer
34
-    */
29
+    /**
30
+     * Sets whether to output highlighted commands instead of the default plain text.
31
+     * 
32
+     * @param bool $highlighted
33
+     * @return Mailcode_Renderer
34
+     */
35 35
     public function setOutputHighlighted(bool $highlighted=true) : Mailcode_Renderer
36 36
     {
37 37
         $this->highlighted = $highlighted;
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
         return $this;
40 40
     }
41 41
     
42
-   /**
43
-    * Converts a show variable command to string.
44
-    * 
45
-    * @param string $variableName The variable name, with or without $ sign.
46
-    * @return string
47
-    */
42
+    /**
43
+     * Converts a show variable command to string.
44
+     * 
45
+     * @param string $variableName The variable name, with or without $ sign.
46
+     * @return string
47
+     */
48 48
     public function showVar(string $variableName) : string
49 49
     {
50 50
         return $this->command2string(Mailcode_Factory::showVar($variableName));
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     * @param bool $highlighted
33 33
     * @return Mailcode_Renderer
34 34
     */
35
-    public function setOutputHighlighted(bool $highlighted=true) : Mailcode_Renderer
35
+    public function setOutputHighlighted(bool $highlighted = true) : Mailcode_Renderer
36 36
     {
37 37
         $this->highlighted = $highlighted;
38 38
         
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
         return $this->command2string(Mailcode_Factory::setVarString($variableName, $value));
61 61
     }
62 62
     
63
-    public function if(string $condition, string $type='') : string
63
+    public function if (string $condition, string $type = '') : string
64 64
     {
65
-        return $this->command2string(Mailcode_Factory::if($condition, $type));
65
+        return $this->command2string(Mailcode_Factory::if ($condition, $type));
66 66
     }
67 67
     
68 68
     public function ifVar(string $variable, string $operand, string $value, bool $quoteValue) : string
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
         return $this->command2string(Mailcode_Factory::ifVarNotEqualsString($variable, $value));
96 96
     }
97 97
     
98
-    public function elseIf(string $condition, string $type='') : string
98
+    public function elseIf (string $condition, string $type = '') : string
99 99
     {
100
-        return $this->command2string(Mailcode_Factory::elseIf($condition, $type));
100
+        return $this->command2string(Mailcode_Factory::elseIf ($condition, $type));
101 101
     }
102 102
     
103 103
     public function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue) : string
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     
148 148
     protected function command2string(Mailcode_Commands_Command $command) : string
149 149
     {
150
-        if($this->highlighted)
150
+        if ($this->highlighted)
151 151
         {
152 152
             return $command->getHighlighted();
153 153
         }
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -62,7 +62,9 @@  discard block
 block discarded – undo
62 62
     
63 63
     public function if(string $condition, string $type='') : string
64 64
     {
65
-        return $this->command2string(Mailcode_Factory::if($condition, $type));
65
+        return $this->command2string(Mailcode_Factory::if($condition, $type) {
66
+            );
67
+        }
66 68
     }
67 69
     
68 70
     public function ifVar(string $variable, string $operand, string $value, bool $quoteValue) : string
@@ -97,7 +99,9 @@  discard block
 block discarded – undo
97 99
     
98 100
     public function elseIf(string $condition, string $type='') : string
99 101
     {
100
-        return $this->command2string(Mailcode_Factory::elseIf($condition, $type));
102
+        return $this->command2string(Mailcode_Factory::elseIf($condition, $type) {
103
+            );
104
+        }
101 105
     }
102 106
     
103 107
     public function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue) : string
@@ -130,10 +134,12 @@  discard block
 block discarded – undo
130 134
         return $this->command2string(Mailcode_Factory::elseIfVarNotEqualsString($variable, $value));
131 135
     }
132 136
     
133
-    public function else() : string
137
+    public function else {
138
+        () : string
134 139
     {
135 140
         return $this->command2string(Mailcode_Factory::else());
136 141
     }
142
+    }
137 143
     
138 144
     public function end() : string
139 145
     {
Please login to merge, or discard this patch.