Passed
Push — master ( c355fd...36c5b6 )
by Sebastian
04:30
created
src/Mailcode/Parser/StringPreProcessor.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      */
63 63
     private function stripStyleTags() : void
64 64
     {
65
-        if(!ConvertHelper::isStringHTML($this->subject))
65
+        if (!ConvertHelper::isStringHTML($this->subject))
66 66
         {
67 67
             return;
68 68
         }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
     private function replaceBrackets(string $subject, string $needle) : string
78 78
     {
79
-        $replacement =  str_replace(
79
+        $replacement = str_replace(
80 80
             array('{', '}'),
81 81
             array(
82 82
                 self::LITERAL_BRACKET_LEFT_REPLACEMENT,
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Tokenizer/Token.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      * @param mixed $subject
47 47
      * @param Mailcode_Commands_Command|null $sourceCommand
48 48
      */
49
-    public function __construct(string $tokenID, string $matchedText, $subject=null, ?Mailcode_Commands_Command $sourceCommand=null)
49
+    public function __construct(string $tokenID, string $matchedText, $subject = null, ?Mailcode_Commands_Command $sourceCommand = null)
50 50
     {
51 51
         $this->tokenID = $tokenID;
52 52
         $this->matchedText = $matchedText;
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
         return $this->matchedText;
87 87
     }
88 88
     
89
-    protected function restoreQuotes(string $subject, bool $escaped=true) : string
89
+    protected function restoreQuotes(string $subject, bool $escaped = true) : string
90 90
     {
91 91
         $replace = '\"';
92 92
 
93
-        if(!$escaped)
93
+        if (!$escaped)
94 94
         {
95 95
             $replace = '"';
96 96
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -28,14 +28,14 @@  discard block
 block discarded – undo
28 28
         '{\s*([a-z]+)\s+([a-z-]+)\s*:([^}]*)}'
29 29
     );
30 30
     
31
-   /**
32
-    * @var Mailcode
33
-    */
31
+    /**
32
+     * @var Mailcode
33
+     */
34 34
     protected $mailcode;
35 35
     
36
-   /**
37
-    * @var Mailcode_Commands
38
-    */
36
+    /**
37
+     * @var Mailcode_Commands
38
+     */
39 39
     protected $commands;
40 40
 
41 41
     /**
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
         $this->commands = $this->mailcode->getCommands();
50 50
     }
51 51
     
52
-   /**
53
-    * Gets the regex format string used to detect commands.
54
-    * 
55
-    * @return string
56
-    */
52
+    /**
53
+     * Gets the regex format string used to detect commands.
54
+     * 
55
+     * @return string
56
+     */
57 57
     protected static function getRegex() : string
58 58
     {
59 59
         return '/'.implode('|', self::COMMAND_REGEX_PARTS).'/sixU';
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
         throw new Mailcode_Exception('Not a command', '', self::ERROR_NOT_A_COMMAND);
176 176
     }
177 177
     
178
-   /**
179
-    * Parses a single regex match: determines which named group
180
-    * matches, and retrieves the according information.
181
-    * 
182
-    * @param array[] $matches The regex results array.
183
-    * @param int $index The matched index.
184
-    * @return Mailcode_Parser_Match
185
-    */
178
+    /**
179
+     * Parses a single regex match: determines which named group
180
+     * matches, and retrieves the according information.
181
+     * 
182
+     * @param array[] $matches The regex results array.
183
+     * @param int $index The matched index.
184
+     * @return Mailcode_Parser_Match
185
+     */
186 186
     protected function parseMatch(array $matches, int $index) : Mailcode_Parser_Match
187 187
     {
188 188
         $name = ''; // the command name, e.g. "showvar"
@@ -220,14 +220,14 @@  discard block
 block discarded – undo
220 220
         );
221 221
     }
222 222
     
223
-   /**
224
-    * Creates an instance of the safeguard tool, which
225
-    * is used to safeguard commands in a string with placeholders.
226
-    * 
227
-    * @param string $subject The string to use to safeguard commands in.
228
-    * @return Mailcode_Parser_Safeguard
229
-    * @see Mailcode_Parser_Safeguard
230
-    */
223
+    /**
224
+     * Creates an instance of the safeguard tool, which
225
+     * is used to safeguard commands in a string with placeholders.
226
+     * 
227
+     * @param string $subject The string to use to safeguard commands in.
228
+     * @return Mailcode_Parser_Safeguard
229
+     * @see Mailcode_Parser_Safeguard
230
+     */
231 231
     public function createSafeguard(string $subject) : Mailcode_Parser_Safeguard
232 232
     {
233 233
         return new Mailcode_Parser_Safeguard($this, $subject);
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         $total = count($matches[0]);
79 79
         $collection = new Mailcode_Collection();
80 80
 
81
-        for($i=0; $i < $total; $i++)
81
+        for ($i = 0; $i < $total; $i++)
82 82
         {
83 83
             $match = $this->parseMatch($matches, $i);
84 84
             
@@ -143,17 +143,17 @@  discard block
 block discarded – undo
143 143
     private function handleNesting(Mailcode_Commands_Command $cmd) : void
144 144
     {
145 145
         // Set the command's parent from the stack, if any is present.
146
-        if(!empty($this->stack))
146
+        if (!empty($this->stack))
147 147
         {
148 148
             $cmd->setParent($this->getStackLast());
149 149
         }
150 150
 
151 151
         // Handle opening and closing commands, adding and removing from the stack.
152
-        if($cmd instanceof Mailcode_Commands_Command_Type_Opening)
152
+        if ($cmd instanceof Mailcode_Commands_Command_Type_Opening)
153 153
         {
154 154
             $this->stack[] = $cmd;
155 155
         }
156
-        else if($cmd instanceof Mailcode_Commands_Command_Type_Closing)
156
+        else if ($cmd instanceof Mailcode_Commands_Command_Type_Closing)
157 157
         {
158 158
             array_pop($this->stack);
159 159
         }
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
     {
168 168
         $cmd = $this->stack[array_key_last($this->stack)];
169 169
 
170
-        if($cmd instanceof Mailcode_Commands_Command)
170
+        if ($cmd instanceof Mailcode_Commands_Command)
171 171
         {
172 172
             return $cmd;
173 173
         }
@@ -196,16 +196,16 @@  discard block
 block discarded – undo
196 196
         // 5 = parameter type command, type
197 197
         // 6 = parameter type command, params
198 198
         
199
-        if(!empty($matches[1][$index]))
199
+        if (!empty($matches[1][$index]))
200 200
         {
201 201
             $name = $matches[1][$index];
202 202
         }
203
-        else if(!empty($matches[2][$index]))
203
+        else if (!empty($matches[2][$index]))
204 204
         {
205 205
             $name = $matches[2][$index];
206 206
             $params = $matches[3][$index];
207 207
         }
208
-        else if(!empty($matches[4][$index]))
208
+        else if (!empty($matches[4][$index]))
209 209
         {
210 210
             $name = $matches[4][$index];
211 211
             $type = $matches[5][$index];
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
      * @param Mailcode_Commands_Command|null $sourceCommand
243 243
      * @return Mailcode_Parser_Statement
244 244
      */
245
-    public function createStatement(string $statement, bool $freeform=false, ?Mailcode_Commands_Command $sourceCommand=null) : Mailcode_Parser_Statement
245
+    public function createStatement(string $statement, bool $freeform = false, ?Mailcode_Commands_Command $sourceCommand = null) : Mailcode_Parser_Statement
246 246
     {
247 247
         return new Mailcode_Parser_Statement($statement, $freeform, $sourceCommand);
248 248
     }
Please login to merge, or discard this patch.