Test Failed
Push — master ( 36c5b6...af11e6 )
by Sebastian
04:51
created
src/Mailcode/Parser/Safeguard/Formatter/Location.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -24,34 +24,34 @@  discard block
 block discarded – undo
24 24
 {
25 25
     public const ERROR_PLACEHOLDER_NOT_FOUND = 66001;
26 26
     
27
-   /**
28
-    * @var Mailcode_Parser_Safeguard_Formatter
29
-    */
27
+    /**
28
+     * @var Mailcode_Parser_Safeguard_Formatter
29
+     */
30 30
     protected $formatter;
31 31
     
32
-   /**
33
-    * @var string
34
-    */
32
+    /**
33
+     * @var string
34
+     */
35 35
     protected $append = '';
36 36
 
37
-   /**
38
-    * @var string
39
-    */
37
+    /**
38
+     * @var string
39
+     */
40 40
     protected $prepend = '';
41 41
     
42
-   /**
43
-    * @var Mailcode_Parser_Safeguard_Placeholder
44
-    */
42
+    /**
43
+     * @var Mailcode_Parser_Safeguard_Placeholder
44
+     */
45 45
     protected $placeholder;
46 46
     
47
-   /**
48
-    * @var Mailcode_StringContainer
49
-    */
47
+    /**
48
+     * @var Mailcode_StringContainer
49
+     */
50 50
     protected $subject;
51 51
     
52
-   /**
53
-    * @var string[]
54
-    */
52
+    /**
53
+     * @var string[]
54
+     */
55 55
     protected $log = array();
56 56
     
57 57
     public function __construct(Mailcode_Parser_Safeguard_Formatter $formatter, Mailcode_Parser_Safeguard_Placeholder $placeholder)
@@ -67,22 +67,22 @@  discard block
 block discarded – undo
67 67
     
68 68
     abstract public function requiresAdjustment() : bool;
69 69
     
70
-   /**
71
-    * @return int|boolean
72
-    */
70
+    /**
71
+     * @return int|boolean
72
+     */
73 73
     public function getStartPosition()
74 74
     {
75 75
         return $this->subject->getSubstrPosition($this->placeholder->getReplacementText());
76 76
     }
77 77
     
78
-   /**
79
-    * Checks whether the specified position within the string
80
-    * is within another command's placeholder (excluding this
81
-    * location's placeholder).
82
-    * 
83
-    * @param int $position
84
-    * @return bool
85
-    */
78
+    /**
79
+     * Checks whether the specified position within the string
80
+     * is within another command's placeholder (excluding this
81
+     * location's placeholder).
82
+     * 
83
+     * @param int $position
84
+     * @return bool
85
+     */
86 86
     public function isWithinCommand(int $position) : bool
87 87
     {
88 88
         $placeholders = $this->formatter->getSafeguard()->getPlaceholdersCollection()->getAll();
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
         return false;
115 115
     }
116 116
     
117
-   /**
118
-    * @return int|boolean
119
-    */
117
+    /**
118
+     * @return int|boolean
119
+     */
120 120
     public function getEndPosition()
121 121
     {
122 122
         $start = $this->getStartPosition();
@@ -139,14 +139,14 @@  discard block
 block discarded – undo
139 139
         return $this->placeholder;
140 140
     }
141 141
     
142
-   /**
143
-    * Replaces the placeholder with the specified replacement text.
144
-    * 
145
-    * @param string $replacementText
146
-    * @throws Mailcode_Exception
147
-    * 
148
-    * @see Mailcode_Parser_Safeguard_Formatter_Location::ERROR_PLACEHOLDER_NOT_FOUND
149
-    */
142
+    /**
143
+     * Replaces the placeholder with the specified replacement text.
144
+     * 
145
+     * @param string $replacementText
146
+     * @throws Mailcode_Exception
147
+     * 
148
+     * @see Mailcode_Parser_Safeguard_Formatter_Location::ERROR_PLACEHOLDER_NOT_FOUND
149
+     */
150 150
     public function replaceWith(string $replacementText) : void
151 151
     {
152 152
         $needle = $this->placeholder->getReplacementText();
@@ -196,10 +196,10 @@  discard block
 block discarded – undo
196 196
         );
197 197
     }
198 198
     
199
-   /**
200
-    * Retrieves the location's log messages, if any.
201
-    * @return string[]
202
-    */
199
+    /**
200
+     * Retrieves the location's log messages, if any.
201
+     * @return string[]
202
+     */
203 203
     public function getLog() : array
204 204
     {
205 205
         return $this->log;
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/Formatter.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -27,19 +27,19 @@  discard block
 block discarded – undo
27 27
 {
28 28
     public const ERROR_INVALID_LOCATION_INSTANCE = 65601;
29 29
     
30
-   /**
31
-    * @var Mailcode_Parser_Safeguard_Formatting
32
-    */
30
+    /**
31
+     * @var Mailcode_Parser_Safeguard_Formatting
32
+     */
33 33
     protected $formatting;
34 34
     
35
-   /**
36
-    * @var Mailcode_StringContainer
37
-    */
35
+    /**
36
+     * @var Mailcode_StringContainer
37
+     */
38 38
     protected $subject;
39 39
     
40
-   /**
41
-    * @var string[]
42
-    */
40
+    /**
41
+     * @var string[]
42
+     */
43 43
     protected $log = array();
44 44
     
45 45
     public function __construct(Mailcode_Parser_Safeguard_Formatting $formatting)
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
         );
99 99
     }
100 100
     
101
-   /**
102
-    * Retrieves all formatter-specific placeholder locations 
103
-    * in the subject string.
104
-    * 
105
-    * @return Mailcode_Parser_Safeguard_Formatter_Location[]
106
-    */
101
+    /**
102
+     * Retrieves all formatter-specific placeholder locations 
103
+     * in the subject string.
104
+     * 
105
+     * @return Mailcode_Parser_Safeguard_Formatter_Location[]
106
+     */
107 107
     protected function resolveLocations() : array
108 108
     {
109 109
         $placeholders = $this->formatting->getSafeguard()->getPlaceholdersCollection()->getAll();
@@ -118,12 +118,12 @@  discard block
 block discarded – undo
118 118
         return $result;
119 119
     }
120 120
     
121
-   /**
122
-    * Resolves the newline character used in the string.
123
-    * 
124
-    * @param string $subject
125
-    * @return string
126
-    */
121
+    /**
122
+     * Resolves the newline character used in the string.
123
+     * 
124
+     * @param string $subject
125
+     * @return string
126
+     */
127 127
     protected function resolveNewlineChar(string $subject) : string
128 128
     {
129 129
         $eol = ConvertHelper::detectEOLCharacter($subject);
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
         );
156 156
     }
157 157
  
158
-   /**
159
-    * @return string[]
160
-    */
158
+    /**
159
+     * @return string[]
160
+     */
161 161
     public function getLog() : array
162 162
     {
163 163
         return $this->log;
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/PlaceholderCollection.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function getByIndex(int $index) : Mailcode_Parser_Safeguard_Placeholder
41 41
     {
42
-        if(isset($this->placeholders[$index]))
42
+        if (isset($this->placeholders[$index]))
43 43
         {
44 44
             return $this->placeholders[$index];
45 45
         }
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 
54 54
     public function getByCommand(Mailcode_Commands_Command $command) : Mailcode_Parser_Safeguard_Placeholder
55 55
     {
56
-        foreach($this->placeholders as $placeholder)
56
+        foreach ($this->placeholders as $placeholder)
57 57
         {
58
-            if($placeholder->getCommand() === $command)
58
+            if ($placeholder->getCommand() === $command)
59 59
             {
60 60
                 return $placeholder;
61 61
             }
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function getByID(int $id) : Mailcode_Parser_Safeguard_Placeholder
79 79
     {
80
-        foreach($this->placeholders as $placeholder)
80
+        foreach ($this->placeholders as $placeholder)
81 81
         {
82
-            if($placeholder->getID() === $id)
82
+            if ($placeholder->getID() === $id)
83 83
             {
84 84
                 return $placeholder;
85 85
             }
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
      */
105 105
     public function getByString(string $string) : Mailcode_Parser_Safeguard_Placeholder
106 106
     {
107
-        foreach($this->placeholders as $placeholder)
107
+        foreach ($this->placeholders as $placeholder)
108 108
         {
109
-            if($placeholder->getReplacementText() === $string)
109
+            if ($placeholder->getReplacementText() === $string)
110 110
             {
111 111
                 return $placeholder;
112 112
             }
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
      */
130 130
     public function getStrings() : array
131 131
     {
132
-        if(is_array($this->placeholderStrings))
132
+        if (is_array($this->placeholderStrings))
133 133
         {
134 134
             return $this->placeholderStrings;
135 135
         }
136 136
 
137 137
         $this->placeholderStrings = array();
138 138
 
139
-        foreach($this->placeholders as $placeholder)
139
+        foreach ($this->placeholders as $placeholder)
140 140
         {
141 141
             $this->placeholderStrings[] = $placeholder->getReplacementText();
142 142
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Tokenizer.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -39,14 +39,14 @@  discard block
 block discarded – undo
39 39
         'ExtractTokens'
40 40
     );
41 41
     
42
-   /**
43
-    * @var Mailcode_Parser_Statement
44
-    */
42
+    /**
43
+     * @var Mailcode_Parser_Statement
44
+     */
45 45
     protected Mailcode_Parser_Statement $statement;
46 46
     
47
-   /**
48
-    * @var string
49
-    */
47
+    /**
48
+     * @var string
49
+     */
50 50
     protected string $tokenized = '';
51 51
     
52 52
     /**
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
      */
55 55
     protected array $tokensOrdered = array();
56 56
     
57
-   /**
58
-    * @var string[]
59
-    */
57
+    /**
58
+     * @var string[]
59
+     */
60 60
     protected static array $ids = array();
61 61
 
62 62
     /**
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
         return $this->statement->getSourceCommand();
77 77
     }
78 78
 
79
-   /**
80
-    * Retrieves all tokens detected in the statement string, in 
81
-    * the order they were found.
82
-    * 
83
-    * @return Mailcode_Parser_Statement_Tokenizer_Token[]
84
-    */
79
+    /**
80
+     * Retrieves all tokens detected in the statement string, in 
81
+     * the order they were found.
82
+     * 
83
+     * @return Mailcode_Parser_Statement_Tokenizer_Token[]
84
+     */
85 85
     public function getTokens() : array
86 86
     {
87 87
         return $this->tokensOrdered;
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
         return !empty($this->tokensOrdered);
93 93
     }
94 94
     
95
-   /**
96
-    * Whether there were any unknown tokens in the statement.
97
-    * 
98
-    * @return bool
99
-    */
95
+    /**
96
+     * Whether there were any unknown tokens in the statement.
97
+     * 
98
+     * @return bool
99
+     */
100 100
     public function hasUnknown() : bool
101 101
     {
102 102
         $unknown = $this->getUnknown();
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
         return !empty($unknown);
105 105
     }
106 106
     
107
-   /**
108
-    * Retrieves all unknown content tokens, if any.
109
-    * 
110
-    * @return Mailcode_Parser_Statement_Tokenizer_Token_Unknown[]
111
-    */
107
+    /**
108
+     * Retrieves all unknown content tokens, if any.
109
+     * 
110
+     * @return Mailcode_Parser_Statement_Tokenizer_Token_Unknown[]
111
+     */
112 112
     public function getUnknown() : array
113 113
     {
114 114
         $result = array();
@@ -293,13 +293,13 @@  discard block
 block discarded – undo
293 293
         return $token;
294 294
     }
295 295
     
296
-   /**
297
-    * Generates a unique alphabet-based ID without numbers
298
-    * to use as token name, to avoid conflicts with the
299
-    * numbers detection.
300
-    *
301
-    * @return string
302
-    */
296
+    /**
297
+     * Generates a unique alphabet-based ID without numbers
298
+     * to use as token name, to avoid conflicts with the
299
+     * numbers detection.
300
+     *
301
+     * @return string
302
+     */
303 303
     protected function generateID() : string
304 304
     {
305 305
         static $alphas;
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
     {
114 114
         $result = array();
115 115
         
116
-        foreach($this->tokensOrdered as $token)
116
+        foreach ($this->tokensOrdered as $token)
117 117
         {
118
-            if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Unknown)
118
+            if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Unknown)
119 119
             {
120 120
                 $result[] = $token;
121 121
             }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     {
129 129
         $unknown = $this->getUnknown();
130 130
         
131
-        if(!empty($unknown))
131
+        if (!empty($unknown))
132 132
         {
133 133
             return array_shift($unknown);
134 134
         }
@@ -140,11 +140,11 @@  discard block
 block discarded – undo
140 140
     {
141 141
         $parts = array();
142 142
         
143
-        foreach($this->tokensOrdered as $token)
143
+        foreach ($this->tokensOrdered as $token)
144 144
         {
145 145
             $string = $token->getNormalized();
146 146
             
147
-            if($string !== '')
147
+            if ($string !== '')
148 148
             {
149 149
                 $parts[] = $string;
150 150
             }
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         $statement = trim($statement);
169 169
         $tokens = array();
170 170
 
171
-        foreach($this->tokenCategories as $tokenCategory)
171
+        foreach ($this->tokenCategories as $tokenCategory)
172 172
         {
173 173
             $processor = $this->createProcessor($tokenCategory, $statement, $tokens);
174 174
             $processor->process();
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 
195 195
         $instance = new $class($this, $statement, $tokens);
196 196
 
197
-        if($instance instanceof Mailcode_Parser_Statement_Tokenizer_Process)
197
+        if ($instance instanceof Mailcode_Parser_Statement_Tokenizer_Process)
198 198
         {
199 199
             return $instance;
200 200
         }
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
      * @param mixed $subject
216 216
      * @return Mailcode_Parser_Statement_Tokenizer_Token
217 217
      */
218
-    public function createToken(string $type, string $matchedText, $subject=null) : Mailcode_Parser_Statement_Tokenizer_Token
218
+    public function createToken(string $type, string $matchedText, $subject = null) : Mailcode_Parser_Statement_Tokenizer_Token
219 219
     {
220 220
         $tokenID = $this->generateID();
221 221
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 
224 224
         $token = new $class($tokenID, $matchedText, $subject, $this->getSourceCommand());
225 225
 
226
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token)
226
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token)
227 227
         {
228 228
             return $token;
229 229
         }
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 
245 245
         $token = $this->appendToken('Keyword', $name);
246 246
 
247
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
247
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
248 248
         {
249 249
             return $token;
250 250
         }
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 
264 264
         foreach ($this->tokensOrdered as $checkToken)
265 265
         {
266
-            if($checkToken->getID() !== $tokenID)
266
+            if ($checkToken->getID() !== $tokenID)
267 267
             {
268 268
                 $keep[] = $checkToken;
269 269
             }
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
      * @param mixed $subject
283 283
      * @return Mailcode_Parser_Statement_Tokenizer_Token
284 284
      */
285
-    protected function appendToken(string $type, string $matchedText, $subject=null) : Mailcode_Parser_Statement_Tokenizer_Token
285
+    protected function appendToken(string $type, string $matchedText, $subject = null) : Mailcode_Parser_Statement_Tokenizer_Token
286 286
     {
287 287
         $token = $this->createToken($type, $matchedText, $subject);
288 288
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
     {
305 305
         static $alphas;
306 306
 
307
-        if(!isset($alphas))
307
+        if (!isset($alphas))
308 308
         {
309 309
             $alphas = range('A', 'Z');
310 310
         }
@@ -313,12 +313,12 @@  discard block
 block discarded – undo
313 313
 
314 314
         $result = '';
315 315
 
316
-        for($i=0; $i < $amount; $i++)
316
+        for ($i = 0; $i < $amount; $i++)
317 317
         {
318 318
             $result .= $alphas[array_rand($alphas)];
319 319
         }
320 320
 
321
-        if(!in_array($result, self::$ids))
321
+        if (!in_array($result, self::$ids))
322 322
         {
323 323
             self::$ids[] = $result;
324 324
             return $result;
Please login to merge, or discard this patch.
src/Mailcode/Factory/CommandSets.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,14 +35,14 @@
 block discarded – undo
35 35
      */
36 36
     private ?Mailcode_Factory_CommandSets_Set_Misc $misc = null;
37 37
     
38
-   /**
39
-    * @var Mailcode_Factory_CommandSets_Set_Set|NULL
40
-    */
38
+    /**
39
+     * @var Mailcode_Factory_CommandSets_Set_Set|NULL
40
+     */
41 41
     private ?Mailcode_Factory_CommandSets_Set_Set $set = null;
42 42
     
43
-   /**
44
-    * @var Mailcode_Factory_CommandSets_Set_ElseIf|NULL
45
-    */
43
+    /**
44
+     * @var Mailcode_Factory_CommandSets_Set_ElseIf|NULL
45
+     */
46 46
     private ?Mailcode_Factory_CommandSets_Set_ElseIf $elseIf = null;
47 47
     
48 48
     public function if() : Mailcode_Factory_CommandSets_Set_If
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
     */
46 46
     private ?Mailcode_Factory_CommandSets_Set_ElseIf $elseIf = null;
47 47
     
48
-    public function if() : Mailcode_Factory_CommandSets_Set_If
48
+    public function if () : Mailcode_Factory_CommandSets_Set_If
49 49
     {
50
-        if(!isset($this->if))
50
+        if (!isset($this->if))
51 51
         {
52 52
             $this->if = new Mailcode_Factory_CommandSets_Set_If();
53 53
         }
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
         return $this->if;
56 56
     }
57 57
     
58
-    public function elseIf() : Mailcode_Factory_CommandSets_Set_ElseIf
58
+    public function elseIf () : Mailcode_Factory_CommandSets_Set_ElseIf
59 59
     {
60
-        if(!isset($this->elseIf))
60
+        if (!isset($this->elseIf))
61 61
         {
62 62
             $this->elseIf = new Mailcode_Factory_CommandSets_Set_ElseIf();
63 63
         }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     
68 68
     public function show() : Mailcode_Factory_CommandSets_Set_Show
69 69
     {
70
-        if(!isset($this->show))
70
+        if (!isset($this->show))
71 71
         {
72 72
             $this->show = new Mailcode_Factory_CommandSets_Set_Show();
73 73
         }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     
78 78
     public function misc() : Mailcode_Factory_CommandSets_Set_Misc
79 79
     {
80
-        if(!isset($this->misc))
80
+        if (!isset($this->misc))
81 81
         {
82 82
             $this->misc = new Mailcode_Factory_CommandSets_Set_Misc();
83 83
         }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     
88 88
     public function set() : Mailcode_Factory_CommandSets_Set_Set
89 89
     {
90
-        if(!isset($this->set))
90
+        if (!isset($this->set))
91 91
         {
92 92
             $this->set = new Mailcode_Factory_CommandSets_Set_Set();
93 93
         }
Please login to merge, or discard this patch.
src/Mailcode/Traits/Commands/Validation/NoHTML.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 
39 39
         $keywords = $this->params->getInfo()->getKeywords();
40 40
 
41
-        foreach($keywords as $keyword)
41
+        foreach ($keywords as $keyword)
42 42
         {
43
-            if($keyword->isNoHTML())
43
+            if ($keyword->isNoHTML())
44 44
             {
45 45
                 $this->noHTMLToken = $keyword;
46 46
                 break;
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      * @return $this
56 56
      * @throws Mailcode_Exception
57 57
      */
58
-    public function setHTMLEnabled(bool $enabled=true) : self
58
+    public function setHTMLEnabled(bool $enabled = true) : self
59 59
     {
60 60
         $this->params->getInfo()->setKeywordEnabled(Mailcode_Commands_Keywords::TYPE_NOHTML, !$enabled);
61 61
 
Please login to merge, or discard this patch.
src/Mailcode/Traits/Commands/ProtectedContent.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
             ->getInfo()
38 38
             ->getTokenByIndex(0);
39 39
 
40
-        if($contentIDToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Number)
40
+        if ($contentIDToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Number)
41 41
         {
42 42
             $this->contentIDToken = $contentIDToken;
43 43
             $this->loadContent();
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
     public function getContentID() : int
54 54
     {
55
-        if(isset($this->contentIDToken))
55
+        if (isset($this->contentIDToken))
56 56
         {
57 57
             return (int)$this->contentIDToken->getValue();
58 58
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
         $this->commands = $this->mailcode->getCommands();
43 43
     }
44 44
     
45
-   /**
46
-    * Gets the regex format string used to detect commands.
47
-    * 
48
-    * @return string
49
-    */
45
+    /**
46
+     * Gets the regex format string used to detect commands.
47
+     * 
48
+     * @return string
49
+     */
50 50
     protected static function getRegex() : string
51 51
     {
52 52
         return '/'.implode('|', self::COMMAND_REGEX_PARTS).'/sixU';
@@ -183,14 +183,14 @@  discard block
 block discarded – undo
183 183
         throw new Mailcode_Exception('Not a command', '', self::ERROR_NOT_A_COMMAND);
184 184
     }
185 185
     
186
-   /**
187
-    * Parses a single regex match: determines which named group
188
-    * matches, and retrieves the according information.
189
-    * 
190
-    * @param array<int,array<int,string>>$matches The regex results array.
191
-    * @param int $index The matched index.
192
-    * @return Mailcode_Parser_Match
193
-    */
186
+    /**
187
+     * Parses a single regex match: determines which named group
188
+     * matches, and retrieves the according information.
189
+     * 
190
+     * @param array<int,array<int,string>>$matches The regex results array.
191
+     * @param int $index The matched index.
192
+     * @return Mailcode_Parser_Match
193
+     */
194 194
     protected function parseMatch(array $matches, int $index) : Mailcode_Parser_Match
195 195
     {
196 196
         $name = ''; // the command name, e.g. "showvar"
@@ -228,14 +228,14 @@  discard block
 block discarded – undo
228 228
         );
229 229
     }
230 230
     
231
-   /**
232
-    * Creates an instance of the safeguard tool, which
233
-    * is used to safeguard commands in a string with placeholders.
234
-    * 
235
-    * @param string $subject The string to use to safeguard commands in.
236
-    * @return Mailcode_Parser_Safeguard
237
-    * @see Mailcode_Parser_Safeguard
238
-    */
231
+    /**
232
+     * Creates an instance of the safeguard tool, which
233
+     * is used to safeguard commands in a string with placeholders.
234
+     * 
235
+     * @param string $subject The string to use to safeguard commands in.
236
+     * @return Mailcode_Parser_Safeguard
237
+     * @see Mailcode_Parser_Safeguard
238
+     */
239 239
     public function createSafeguard(string $subject) : Mailcode_Parser_Safeguard
240 240
     {
241 241
         return new Mailcode_Parser_Safeguard($this, $subject);
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
         $result = new Mailcode_Parser_ParseResult($collection, $preParser);
71 71
 
72
-        if(!$collection->isValid())
72
+        if (!$collection->isValid())
73 73
         {
74 74
             return $result;
75 75
         }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         
82 82
         $total = count($matches[0]);
83 83
 
84
-        for($i=0; $i < $total; $i++)
84
+        for ($i = 0; $i < $total; $i++)
85 85
         {
86 86
             $match = $this->parseMatch($matches, $i);
87 87
             
@@ -151,17 +151,17 @@  discard block
 block discarded – undo
151 151
     private function handleNesting(Mailcode_Commands_Command $cmd) : void
152 152
     {
153 153
         // Set the command's parent from the stack, if any is present.
154
-        if(!empty($this->stack))
154
+        if (!empty($this->stack))
155 155
         {
156 156
             $cmd->setParent($this->getStackLast());
157 157
         }
158 158
 
159 159
         // Handle opening and closing commands, adding and removing from the stack.
160
-        if($cmd instanceof Mailcode_Commands_Command_Type_Opening)
160
+        if ($cmd instanceof Mailcode_Commands_Command_Type_Opening)
161 161
         {
162 162
             $this->stack[] = $cmd;
163 163
         }
164
-        else if($cmd instanceof Mailcode_Commands_Command_Type_Closing)
164
+        else if ($cmd instanceof Mailcode_Commands_Command_Type_Closing)
165 165
         {
166 166
             array_pop($this->stack);
167 167
         }
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
     {
176 176
         $cmd = $this->stack[array_key_last($this->stack)];
177 177
 
178
-        if($cmd instanceof Mailcode_Commands_Command)
178
+        if ($cmd instanceof Mailcode_Commands_Command)
179 179
         {
180 180
             return $cmd;
181 181
         }
@@ -204,16 +204,16 @@  discard block
 block discarded – undo
204 204
         // 5 = parameter type command, type
205 205
         // 6 = parameter type command, params
206 206
         
207
-        if(!empty($matches[1][$index]))
207
+        if (!empty($matches[1][$index]))
208 208
         {
209 209
             $name = $matches[1][$index];
210 210
         }
211
-        else if(!empty($matches[2][$index]))
211
+        else if (!empty($matches[2][$index]))
212 212
         {
213 213
             $name = $matches[2][$index];
214 214
             $params = $matches[3][$index];
215 215
         }
216
-        else if(!empty($matches[4][$index]))
216
+        else if (!empty($matches[4][$index]))
217 217
         {
218 218
             $name = $matches[4][$index];
219 219
             $type = $matches[5][$index];
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
      * @param Mailcode_Commands_Command|null $sourceCommand
251 251
      * @return Mailcode_Parser_Statement
252 252
      */
253
-    public function createStatement(string $statement, bool $freeform=false, ?Mailcode_Commands_Command $sourceCommand=null) : Mailcode_Parser_Statement
253
+    public function createStatement(string $statement, bool $freeform = false, ?Mailcode_Commands_Command $sourceCommand = null) : Mailcode_Parser_Statement
254 254
     {
255 255
         return new Mailcode_Parser_Statement($statement, $freeform, $sourceCommand);
256 256
     }
Please login to merge, or discard this patch.
src/Mailcode/Translator/Syntax.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
     public const ERROR_UNKNOWN_COMMAND_TYPE = 50401;
25 25
     public const ERROR_INVALID_COMMAND_INSTANCE = 50402;
26 26
     
27
-   /**
28
-    * @var string
29
-    */
27
+    /**
28
+     * @var string
29
+     */
30 30
     protected string $typeID;
31 31
     
32 32
     public function __construct(string $typeID)
@@ -34,22 +34,22 @@  discard block
 block discarded – undo
34 34
         $this->typeID = $typeID;
35 35
     }
36 36
     
37
-   /**
38
-    * Retrieves the syntax' type ID, e.g. "ApacheVelocity".
39
-    * @return string
40
-    */
37
+    /**
38
+     * Retrieves the syntax' type ID, e.g. "ApacheVelocity".
39
+     * @return string
40
+     */
41 41
     public function getTypeID() : string
42 42
     {
43 43
         return $this->typeID;
44 44
     }
45 45
     
46
-   /**
47
-    * Translates a single command to the target syntax.
48
-    * 
49
-    * @param Mailcode_Commands_Command $command
50
-    * @throws Mailcode_Translator_Exception
51
-    * @return string
52
-    */
46
+    /**
47
+     * Translates a single command to the target syntax.
48
+     * 
49
+     * @param Mailcode_Commands_Command $command
50
+     * @throws Mailcode_Translator_Exception
51
+     * @return string
52
+     */
53 53
     public function translateCommand(Mailcode_Commands_Command $command) : string
54 54
     {
55 55
         return $this->createTranslator($command)->translate($command);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
             $command->getID()
64 64
         );
65 65
         
66
-        if(!class_exists($class))
66
+        if (!class_exists($class))
67 67
         {
68 68
             throw new Mailcode_Translator_Exception(
69 69
                 sprintf('Unknown command %s in translator', $command->getID()),
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         
78 78
         $translator = new $class($command);
79 79
 
80
-        if($translator instanceof Mailcode_Translator_Command)
80
+        if ($translator instanceof Mailcode_Translator_Command)
81 81
         {
82 82
             return $translator;
83 83
         }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     {
106 106
         $subject = $safeguard->makeSafe();
107 107
         
108
-        if(!$safeguard->hasPlaceholders())
108
+        if (!$safeguard->hasPlaceholders())
109 109
         {
110 110
             return $subject;
111 111
         }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         
115 115
         $replaces = array();
116 116
         
117
-        foreach($placeholders as $placeholder)
117
+        foreach ($placeholders as $placeholder)
118 118
         {
119 119
             $command = $placeholder->getCommand();
120 120
 
Please login to merge, or discard this patch.