Passed
Push — master ( be419d...14187a )
by Sebastian
04:17 queued 33s
created
src/Mailcode/Parser/PreParser/Debugger.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,22 +30,22 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function debugOpeningCommands(array $matches) : void
32 32
     {
33
-        if(!Mailcode::isDebugEnabled())
33
+        if (!Mailcode::isDebugEnabled())
34 34
         {
35 35
             return;
36 36
         }
37 37
 
38 38
         Mailcode::debug('Opening command matches:');
39 39
 
40
-        if(empty($matches))
40
+        if (empty($matches))
41 41
         {
42 42
             Mailcode::debug('...None found.');
43 43
             return;
44 44
         }
45 45
 
46
-        foreach($matches[0] as $idx => $matchedText)
46
+        foreach ($matches[0] as $idx => $matchedText)
47 47
         {
48
-            $number = $idx+1;
48
+            $number = $idx + 1;
49 49
 
50 50
             Mailcode::debug(sprintf('...#%02d matched: [%s]', $number, $matchedText));
51 51
             Mailcode::debug(sprintf('...#%02d name...: [%s]', $number, $matches[1][$idx]));
@@ -59,22 +59,22 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public function debugClosingCommands(array $commands) : void
61 61
     {
62
-        if(!Mailcode::isDebugEnabled())
62
+        if (!Mailcode::isDebugEnabled())
63 63
         {
64 64
             return;
65 65
         }
66 66
 
67 67
         Mailcode::debug('Closing command matches:', $commands);
68 68
 
69
-        if(empty($commands))
69
+        if (empty($commands))
70 70
         {
71 71
             Mailcode::debug('...None found.');
72 72
             return;
73 73
         }
74 74
 
75
-        foreach($commands as $idx => $command)
75
+        foreach ($commands as $idx => $command)
76 76
         {
77
-            $number = $idx+1;
77
+            $number = $idx + 1;
78 78
 
79 79
             Mailcode::debug(sprintf('...#%02d matched: [%s]', $number, $command['matchedText']));
80 80
             Mailcode::debug(sprintf('...#%02d name...: [%s]', $number, $command['name']));
@@ -83,14 +83,14 @@  discard block
 block discarded – undo
83 83
 
84 84
     public function debugCommandDef(CommandDef $commandDef) : void
85 85
     {
86
-        if(!Mailcode::isDebugEnabled())
86
+        if (!Mailcode::isDebugEnabled())
87 87
         {
88 88
             return;
89 89
         }
90 90
 
91 91
         Mailcode::debug('Command definition:', $commandDef->toArray());
92 92
 
93
-        if(defined('TESTS_ROOT'))
93
+        if (defined('TESTS_ROOT'))
94 94
         {
95 95
             print_r($commandDef->toArray());
96 96
         }
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/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.
src/Mailcode/Factory/Instantiator.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
  */
23 23
 class Mailcode_Factory_Instantiator
24 24
 {
25
-    public function buildIf(string $ifType, string $params, string $type='') : Mailcode_Commands_IfBase
25
+    public function buildIf(string $ifType, string $params, string $type = '') : Mailcode_Commands_IfBase
26 26
     {
27 27
         $stringType = $type;
28 28
         
29
-        if(!empty($type))
29
+        if (!empty($type))
30 30
         {
31 31
             $stringType = ' '.$type;
32 32
         }
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         
46 46
         $this->checkCommand($command);
47 47
         
48
-        if($command instanceof Mailcode_Commands_IfBase)
48
+        if ($command instanceof Mailcode_Commands_IfBase)
49 49
         {
50 50
             return $command;
51 51
         }
@@ -53,16 +53,16 @@  discard block
 block discarded – undo
53 53
         throw $this->exceptionUnexpectedType('IfBase', $command);
54 54
     }
55 55
     
56
-    public function buildIfVar(string $ifType, string $variable, string $operand, string $value, bool $quoteValue=false, bool $insensitive=false) : Mailcode_Commands_IfBase
56
+    public function buildIfVar(string $ifType, string $variable, string $operand, string $value, bool $quoteValue = false, bool $insensitive = false) : Mailcode_Commands_IfBase
57 57
     {
58 58
         $variable = $this->filterVariableName($variable);
59 59
 
60
-        if($insensitive)
60
+        if ($insensitive)
61 61
         {
62 62
             $value = mb_strtolower($value);
63 63
         }
64 64
 
65
-        if($quoteValue)
65
+        if ($quoteValue)
66 66
         {
67 67
             $value = $this->quoteString($value);
68 68
         }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
             $value
75 75
         );
76 76
 
77
-        if($insensitive)
77
+        if ($insensitive)
78 78
         {
79 79
             $condition .= ' '.Mailcode_Commands_Keywords::TYPE_INSENSITIVE;
80 80
         }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      * @return Mailcode_Commands_IfBase
103 103
      * @throws Mailcode_Factory_Exception
104 104
      */
105
-    public function buildIfContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false, string $containsType='contains') : Mailcode_Commands_IfBase
105
+    public function buildIfContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false, string $containsType = 'contains') : Mailcode_Commands_IfBase
106 106
     {
107 107
         $condition = sprintf(
108 108
             '%s%s"%s"',
@@ -114,23 +114,23 @@  discard block
 block discarded – undo
114 114
         return $this->buildIf($ifType, $condition, $containsType);
115 115
     }
116 116
 
117
-    private function renderListKeywords(bool $caseInsensitive=false, bool $regexEnabled=false) : string
117
+    private function renderListKeywords(bool $caseInsensitive = false, bool $regexEnabled = false) : string
118 118
     {
119 119
         $keywords = array();
120 120
 
121
-        if($caseInsensitive)
121
+        if ($caseInsensitive)
122 122
         {
123 123
             $keywords[] = Mailcode_Commands_Keywords::TYPE_INSENSITIVE;
124 124
         }
125 125
 
126
-        if($regexEnabled)
126
+        if ($regexEnabled)
127 127
         {
128 128
             $keywords[] = Mailcode_Commands_Keywords::TYPE_REGEX;
129 129
         }
130 130
 
131 131
         $keywordsString = '';
132 132
 
133
-        if(!empty($keywords))
133
+        if (!empty($keywords))
134 134
         {
135 135
             $keywordsString = ' '.implode(' ', $keywords);
136 136
         }
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      * @return Mailcode_Commands_IfBase
148 148
      * @throws Mailcode_Factory_Exception
149 149
      */
150
-    public function buildIfNotContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_IfBase
150
+    public function buildIfNotContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_IfBase
151 151
     {
152 152
         return $this->buildIfContains($ifType, $variable, $searchTerms, $caseInsensitive, $regexEnabled, 'not-contains');
153 153
     }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      * @return Mailcode_Commands_IfBase
163 163
      * @throws Mailcode_Factory_Exception
164 164
      */
165
-    public function buildIfListContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false, string $containsType='list-contains') : Mailcode_Commands_IfBase
165
+    public function buildIfListContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false, string $containsType = 'list-contains') : Mailcode_Commands_IfBase
166 166
     {
167 167
         return $this->buildIfContains($ifType, $variable, $searchTerms, $caseInsensitive, $regexEnabled, $containsType);
168 168
     }
@@ -176,17 +176,17 @@  discard block
 block discarded – undo
176 176
      * @return Mailcode_Commands_IfBase
177 177
      * @throws Mailcode_Factory_Exception
178 178
      */
179
-    public function buildIfListNotContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_IfBase
179
+    public function buildIfListNotContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_IfBase
180 180
     {
181 181
         return $this->buildIfContains($ifType, $variable, $searchTerms, $caseInsensitive, $regexEnabled, 'list-not-contains');
182 182
     }
183 183
 
184
-    public function buildIfBeginsWith(string $ifType, string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_IfBase
184
+    public function buildIfBeginsWith(string $ifType, string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_IfBase
185 185
     {
186 186
         return $this->buildIfSearch($ifType, 'begins-with', $variable, $search, $caseInsensitive);
187 187
     }
188 188
     
189
-    public function buildIfEndsWith(string $ifType, string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_IfBase
189
+    public function buildIfEndsWith(string $ifType, string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_IfBase
190 190
     {
191 191
         return $this->buildIfSearch($ifType, 'ends-with', $variable, $search, $caseInsensitive);
192 192
     }
@@ -236,11 +236,11 @@  discard block
 block discarded – undo
236 236
         );
237 237
     }
238 238
 
239
-    private function buildIfSearch(string $ifType, string $subType, string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_IfBase
239
+    private function buildIfSearch(string $ifType, string $subType, string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_IfBase
240 240
     {
241 241
         $keyword = ' ';
242 242
         
243
-        if($caseInsensitive)
243
+        if ($caseInsensitive)
244 244
         {
245 245
             $keyword = ' '.Mailcode_Commands_Keywords::TYPE_INSENSITIVE;
246 246
         }
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
     
275 275
     public function checkCommand(Mailcode_Commands_Command $command) : void
276 276
     {
277
-        if($command->isValid())
277
+        if ($command->isValid())
278 278
         {
279 279
             return;
280 280
         }
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
      */
304 304
     public function setEncoding(Mailcode_Commands_Command $cmd, string $urlEncoding) : void
305 305
     {
306
-        if($cmd instanceof Mailcode_Interfaces_Commands_Validation_URLEncode)
306
+        if ($cmd instanceof Mailcode_Interfaces_Commands_Validation_URLEncode)
307 307
         {
308 308
             $cmd->setURLEncoding(false);
309 309
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
             }
314 314
         }
315 315
 
316
-        if($cmd instanceof Mailcode_Interfaces_Commands_Validation_URLDecode)
316
+        if ($cmd instanceof Mailcode_Interfaces_Commands_Validation_URLDecode)
317 317
         {
318 318
             $cmd->setURLDecoding(false);
319 319
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
      */
333 333
     public function quoteString(string $string) : string
334 334
     {
335
-        if(substr($string, 0, 1) === '"' && substr($string, -1, 1) === '"') {
335
+        if (substr($string, 0, 1) === '"' && substr($string, -1, 1) === '"') {
336 336
             return $string;
337 337
         }
338 338
 
Please login to merge, or discard this patch.