Test Failed
Push — master ( 9ff364...742ef2 )
by Sebastian
03:58
created
src/Mailcode/Parser/Statement/Tokenizer/Token.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 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;
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
     protected string $matchedText;
25 25
     private ?Mailcode_Commands_Command $sourceCommand;
26 26
 
27
-   /**
28
-    * @var mixed
29
-    */
27
+    /**
28
+     * @var mixed
29
+     */
30 30
     protected $subject;
31 31
 
32 32
     /**
@@ -58,20 +58,20 @@  discard block
 block discarded – undo
58 58
         return $this->sourceCommand;
59 59
     }
60 60
     
61
-   /**
62
-    * The ID of the type. i.e. the class name ("Keyword", "StringLiteral").
63
-    * @return string
64
-    */
61
+    /**
62
+     * The ID of the type. i.e. the class name ("Keyword", "StringLiteral").
63
+     * @return string
64
+     */
65 65
     public function getTypeID() : string
66 66
     {
67 67
         $parts = explode('_', get_class($this));
68 68
         return array_pop($parts);
69 69
     }
70 70
     
71
-   /**
72
-    * Retrieves a unique ID of the token.
73
-    * @return string  
74
-    */
71
+    /**
72
+     * Retrieves a unique ID of the token.
73
+     * @return string  
74
+     */
75 75
     public function getID() : string
76 76
     {
77 77
         return $this->tokenID;
Please login to merge, or discard this patch.
src/Mailcode/Parser/Match.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -23,24 +23,24 @@
 block discarded – undo
23 23
  */
24 24
 class Mailcode_Parser_Match
25 25
 {
26
-   /**
27
-    * @var string
28
-    */
26
+    /**
27
+     * @var string
28
+     */
29 29
     protected string $name;
30 30
     
31
-   /**
32
-    * @var string
33
-    */
31
+    /**
32
+     * @var string
33
+     */
34 34
     protected string $type;
35 35
     
36
-   /**
37
-    * @var string
38
-    */
36
+    /**
37
+     * @var string
38
+     */
39 39
     protected string $params;
40 40
     
41
-   /**
42
-    * @var string
43
-    */
41
+    /**
42
+     * @var string
43
+     */
44 44
     protected string $matchedString;
45 45
     
46 46
     public function __construct(string $name, string $type, string $params, string $matchedString)
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/URLAnalyzer.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -58,24 +58,24 @@  discard block
 block discarded – undo
58 58
     private function analyzeURL(string $url) : void
59 59
     {
60 60
         // Ignore phone URLs
61
-        if(stripos($url, 'tel:') !== false)
61
+        if (stripos($url, 'tel:') !== false)
62 62
         {
63 63
             return;
64 64
         }
65 65
 
66 66
         $placeholders = $this->safeguard->getPlaceholdersCollection()->getAll();
67 67
 
68
-        foreach($placeholders as $placeholder)
68
+        foreach ($placeholders as $placeholder)
69 69
         {
70 70
             $command = $placeholder->getCommand();
71 71
 
72 72
             // The URL is not found in the replacement text
73
-            if(strpos($url, $placeholder->getReplacementText()) === false)
73
+            if (strpos($url, $placeholder->getReplacementText()) === false)
74 74
             {
75 75
                 continue;
76 76
             }
77 77
 
78
-            if($command instanceof URLEncodingInterface)
78
+            if ($command instanceof URLEncodingInterface)
79 79
             {
80 80
                 $this->applyEncoding($command);
81 81
             }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
     private function applyEncoding(URLEncodingInterface $command) : void
86 86
     {
87
-        if(!$command->isURLDecoded())
87
+        if (!$command->isURLDecoded())
88 88
         {
89 89
             $command->setURLEncoding();
90 90
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Tokenizer/SpecialChars.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@
 block discarded – undo
101 101
     {
102 102
         $replaces = array();
103 103
 
104
-        foreach(self::$charsEncoded as $char => $placeholder)
104
+        foreach (self::$charsEncoded as $char => $placeholder)
105 105
         {
106 106
             $escaped = self::$charsEscaped[$char];
107 107
 
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Tokenizer/Token/Variable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
      */
29 29
     public function getVariable() : Mailcode_Variables_Variable
30 30
     {
31
-        if($this->subject instanceof Mailcode_Variables_Variable)
31
+        if ($this->subject instanceof Mailcode_Variables_Variable)
32 32
         {
33 33
             return $this->subject;
34 34
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Tokenizer/Token/StringLiteral.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -35,31 +35,31 @@
 block discarded – undo
35 35
     }
36 36
 
37 37
     /**
38
-    * Retrieves the text with the surrounding quotes,
39
-    * and special characters escaped for Mailcode.
40
-    *
41
-    * @return string
42
-    */
38
+     * Retrieves the text with the surrounding quotes,
39
+     * and special characters escaped for Mailcode.
40
+     *
41
+     * @return string
42
+     */
43 43
     public function getNormalized() : string
44 44
     {
45 45
         return '"'.SpecialChars::escape($this->text).'"';
46 46
     }
47 47
     
48
-   /**
49
-    * Retrieves the text with the surrounding quotes.
50
-    * @return string
51
-    */
48
+    /**
49
+     * Retrieves the text with the surrounding quotes.
50
+     * @return string
51
+     */
52 52
     public function getValue() : string
53 53
     {
54 54
         return $this->getNormalized();
55 55
     }
56 56
     
57
-   /**
58
-    * Retrieves the text without the surrounding quotes,
59
-    * and special Mailcode characters not escaped.
60
-    *
61
-    * @return string
62
-    */
57
+    /**
58
+     * Retrieves the text without the surrounding quotes,
59
+     * and special Mailcode characters not escaped.
60
+     *
61
+     * @return string
62
+     */
63 63
     public function getText() : string
64 64
     {
65 65
         return SpecialChars::decode($this->text);
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
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
         Mailcode_Parser_Statement_Tokenizer_Process_ExtractTokens::class
42 42
     );
43 43
     
44
-   /**
45
-    * @var Mailcode_Parser_Statement
46
-    */
44
+    /**
45
+     * @var Mailcode_Parser_Statement
46
+     */
47 47
     protected Mailcode_Parser_Statement $statement;
48 48
     
49
-   /**
50
-    * @var string
51
-    */
49
+    /**
50
+     * @var string
51
+     */
52 52
     protected string $tokenized = '';
53 53
     
54 54
     /**
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
      */
57 57
     protected array $tokensOrdered = array();
58 58
     
59
-   /**
60
-    * @var string[]
61
-    */
59
+    /**
60
+     * @var string[]
61
+     */
62 62
     protected static array $ids = array();
63 63
 
64 64
     /**
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
         return $this->statement->getSourceCommand();
79 79
     }
80 80
 
81
-   /**
82
-    * Retrieves all tokens detected in the statement string, in 
83
-    * the order they were found.
84
-    * 
85
-    * @return Mailcode_Parser_Statement_Tokenizer_Token[]
86
-    */
81
+    /**
82
+     * Retrieves all tokens detected in the statement string, in 
83
+     * the order they were found.
84
+     * 
85
+     * @return Mailcode_Parser_Statement_Tokenizer_Token[]
86
+     */
87 87
     public function getTokens() : array
88 88
     {
89 89
         return $this->tokensOrdered;
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
         return !empty($this->tokensOrdered);
95 95
     }
96 96
     
97
-   /**
98
-    * Whether there were any unknown tokens in the statement.
99
-    * 
100
-    * @return bool
101
-    */
97
+    /**
98
+     * Whether there were any unknown tokens in the statement.
99
+     * 
100
+     * @return bool
101
+     */
102 102
     public function hasUnknown() : bool
103 103
     {
104 104
         $unknown = $this->getUnknown();
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
         return !empty($unknown);
107 107
     }
108 108
     
109
-   /**
110
-    * Retrieves all unknown content tokens, if any.
111
-    * 
112
-    * @return Mailcode_Parser_Statement_Tokenizer_Token_Unknown[]
113
-    */
109
+    /**
110
+     * Retrieves all unknown content tokens, if any.
111
+     * 
112
+     * @return Mailcode_Parser_Statement_Tokenizer_Token_Unknown[]
113
+     */
114 114
     public function getUnknown() : array
115 115
     {
116 116
         $result = array();
@@ -313,13 +313,13 @@  discard block
 block discarded – undo
313 313
         return $token;
314 314
     }
315 315
     
316
-   /**
317
-    * Generates a unique alphabet-based ID without numbers
318
-    * to use as token name, to avoid conflicts with the
319
-    * numbers detection.
320
-    *
321
-    * @return string
322
-    */
316
+    /**
317
+     * Generates a unique alphabet-based ID without numbers
318
+     * to use as token name, to avoid conflicts with the
319
+     * numbers detection.
320
+     *
321
+     * @return string
322
+     */
323 323
     protected function generateID() : string
324 324
     {
325 325
         static $alphas;
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
     {
116 116
         $result = array();
117 117
         
118
-        foreach($this->tokensOrdered as $token)
118
+        foreach ($this->tokensOrdered as $token)
119 119
         {
120
-            if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Unknown)
120
+            if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Unknown)
121 121
             {
122 122
                 $result[] = $token;
123 123
             }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     {
131 131
         $unknown = $this->getUnknown();
132 132
         
133
-        if(!empty($unknown))
133
+        if (!empty($unknown))
134 134
         {
135 135
             return array_shift($unknown);
136 136
         }
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
     {
143 143
         $parts = array();
144 144
         
145
-        foreach($this->tokensOrdered as $token)
145
+        foreach ($this->tokensOrdered as $token)
146 146
         {
147 147
             $string = $token->getNormalized();
148 148
             
149
-            if($string !== '')
149
+            if ($string !== '')
150 150
             {
151 151
                 $parts[] = $string;
152 152
             }
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         $statement = trim($statement);
172 172
         $tokens = array();
173 173
 
174
-        foreach($this->tokenClasses as $tokenClass)
174
+        foreach ($this->tokenClasses as $tokenClass)
175 175
         {
176 176
             $processor = $this->createProcessor($tokenClass, $statement, $tokens);
177 177
             $processor->process();
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
     {
196 196
         $instance = new $className($this, $statement, $tokens);
197 197
 
198
-        if($instance instanceof Mailcode_Parser_Statement_Tokenizer_Process)
198
+        if ($instance instanceof Mailcode_Parser_Statement_Tokenizer_Process)
199 199
         {
200 200
             return $instance;
201 201
         }
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
      * @param mixed $subject
217 217
      * @return Mailcode_Parser_Statement_Tokenizer_Token
218 218
      */
219
-    public function createToken(string $type, string $matchedText, $subject=null) : Mailcode_Parser_Statement_Tokenizer_Token
219
+    public function createToken(string $type, string $matchedText, $subject = null) : Mailcode_Parser_Statement_Tokenizer_Token
220 220
     {
221 221
         $tokenID = $this->generateID();
222 222
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 
225 225
         $token = new $class($tokenID, $matchedText, $subject, $this->getSourceCommand());
226 226
 
227
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token)
227
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token)
228 228
         {
229 229
             return $token;
230 230
         }
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 
246 246
         $token = $this->appendToken('Keyword', $name);
247 247
 
248
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
248
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
249 249
         {
250 250
             return $token;
251 251
         }
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
             SpecialChars::encodeAll($text)
265 265
         );
266 266
 
267
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral)
267
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral)
268 268
         {
269 269
             return $token;
270 270
         }
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
         foreach ($this->tokensOrdered as $checkToken)
285 285
         {
286
-            if($checkToken->getID() !== $tokenID)
286
+            if ($checkToken->getID() !== $tokenID)
287 287
             {
288 288
                 $keep[] = $checkToken;
289 289
             }
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
      * @param mixed $subject
303 303
      * @return Mailcode_Parser_Statement_Tokenizer_Token
304 304
      */
305
-    protected function appendToken(string $type, string $matchedText, $subject=null) : Mailcode_Parser_Statement_Tokenizer_Token
305
+    protected function appendToken(string $type, string $matchedText, $subject = null) : Mailcode_Parser_Statement_Tokenizer_Token
306 306
     {
307 307
         $token = $this->createToken($type, $matchedText, $subject);
308 308
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
     {
325 325
         static $alphas;
326 326
 
327
-        if(!isset($alphas))
327
+        if (!isset($alphas))
328 328
         {
329 329
             $alphas = range('A', 'Z');
330 330
         }
@@ -333,12 +333,12 @@  discard block
 block discarded – undo
333 333
 
334 334
         $result = '';
335 335
 
336
-        for($i=0; $i < $amount; $i++)
336
+        for ($i = 0; $i < $amount; $i++)
337 337
         {
338 338
             $result .= $alphas[array_rand($alphas)];
339 339
         }
340 340
 
341
-        if(!in_array($result, self::$ids))
341
+        if (!in_array($result, self::$ids))
342 342
         {
343 343
             self::$ids[] = $result;
344 344
             return $result;
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Info/Keywords.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     {
44 44
         $token = $this->info->getTokenByIndex($index);
45 45
 
46
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
46
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
47 47
         {
48 48
             return $token;
49 49
         }
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
     {
63 63
         $tokens = $this->getAll();
64 64
 
65
-        foreach($tokens as $token)
65
+        foreach ($tokens as $token)
66 66
         {
67
-            if($token->getKeyword() === $name)
67
+            if ($token->getKeyword() === $name)
68 68
             {
69 69
                 return $token;
70 70
             }
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
         $result = array();
82 82
         $tokens = $this->info->getTokens();
83 83
 
84
-        foreach($tokens as $token)
84
+        foreach ($tokens as $token)
85 85
         {
86
-            if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
86
+            if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
87 87
             {
88 88
                 $result[] = $token;
89 89
             }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      */
103 103
     public function setEnabled(string $keyword, bool $enabled) : Mailcode_Parser_Statement_Info_Keywords
104 104
     {
105
-        if($enabled)
105
+        if ($enabled)
106 106
         {
107 107
             return $this->add($keyword);
108 108
         }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     {
122 122
         $keyword = rtrim($keyword, ':').':';
123 123
 
124
-        if(!$this->hasKeyword($keyword))
124
+        if (!$this->hasKeyword($keyword))
125 125
         {
126 126
             $this->tokenizer->appendKeyword($keyword);
127 127
         }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
         foreach ($keywords as $kw)
168 168
         {
169
-            if($kw->getKeyword() === $keyword)
169
+            if ($kw->getKeyword() === $keyword)
170 170
             {
171 171
                 return true;
172 172
             }
Please login to merge, or discard this patch.
src/Mailcode/Parser/StringPreProcessor.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      */
80 80
     private function stripStyleTags() : void
81 81
     {
82
-        if(!ConvertHelper::isStringHTML($this->subject))
82
+        if (!ConvertHelper::isStringHTML($this->subject))
83 83
         {
84 84
             return;
85 85
         }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
     private function escapeRegexBracketMatch(string $subject, string $needle) : string
95 95
     {
96
-        $replacement =  str_replace(
96
+        $replacement = str_replace(
97 97
             array('{', '}'),
98 98
             array('\{', '\}'),
99 99
             $needle
Please login to merge, or discard this patch.