Passed
Push — master ( f87868...1b5df6 )
by Sebastian
02:44
created
src/Mailcode/Variables.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
         $matches = array();
41 41
         preg_match_all(self::REGEX_VARIABLE_NAME, $subject, $matches, PREG_PATTERN_ORDER);
42 42
         
43
-        if(!isset($matches[0]) || empty($matches[0]))
43
+        if (!isset($matches[0]) || empty($matches[0]))
44 44
         {
45 45
             return $this->collection;
46 46
         }
47 47
         
48
-        foreach($matches[0] as $idx => $matchedText)
48
+        foreach ($matches[0] as $idx => $matchedText)
49 49
         {
50
-            if(!empty($matches[3][$idx]))
50
+            if (!empty($matches[3][$idx]))
51 51
             {
52 52
                 $this->addSingle($matches[3][$idx], $matchedText);
53 53
             }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     protected function addSingle(string $name, string $matchedText) : void
64 64
     {
65 65
         // ignore US style numbers like $451
66
-        if(is_numeric($name))
66
+        if (is_numeric($name))
67 67
         {
68 68
             return;
69 69
         }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     protected function addPathed(string $path, string $name, string $matchedText) : void
75 75
     {
76 76
         // ignore US style numbers like $45.12
77
-        if(is_numeric($path.'.'.$name))
77
+        if (is_numeric($path.'.'.$name))
78 78
         {
79 79
             return;
80 80
         }
Please login to merge, or discard this patch.
src/Mailcode/Translator/Syntax/ApacheVelocity.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     {
25 25
         $params = $command->getParams();
26 26
         
27
-        if($params)
27
+        if ($params)
28 28
         {
29 29
             return sprintf(
30 30
                 '#elseif(%s)',
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     {
45 45
         $params = $command->getParams();
46 46
     
47
-        if($params)
47
+        if ($params)
48 48
         {
49 49
             return sprintf(
50 50
                 '#if(%s)',
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     {
65 65
         $params = $command->getParams();
66 66
         
67
-        if($params)
67
+        if ($params)
68 68
         {
69 69
             return sprintf(
70 70
                 '#for(%s)',
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     {
80 80
         $params = $command->getParams();
81 81
         
82
-        if($params)
82
+        if ($params)
83 83
         {
84 84
             return sprintf(
85 85
                 '#set(%s)',
Please login to merge, or discard this patch.
src/Mailcode/Translator/Syntax.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         
48 48
         $method = '_translate'.$id;
49 49
         
50
-        if(!method_exists($this, $method))
50
+        if (!method_exists($this, $method))
51 51
         {
52 52
             throw new Mailcode_Translator_Exception(
53 53
                 'Unknown command type in translator',
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     {
75 75
         $subject = $safeguard->makeSafe();
76 76
         
77
-        if(!$safeguard->hasPlaceholders())
77
+        if (!$safeguard->hasPlaceholders())
78 78
         {
79 79
             return $subject;
80 80
         }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         
84 84
         $replaces = array();
85 85
         
86
-        foreach($placeholders as $placeholder)
86
+        foreach ($placeholders as $placeholder)
87 87
         {
88 88
             $replaces[$placeholder->getReplacementText()] = $this->translateCommand($placeholder->getCommand());
89 89
         }
Please login to merge, or discard this patch.
src/Mailcode.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     */
74 74
     public function getParser() : Mailcode_Parser
75 75
     {
76
-        if(!isset($this->parser)) 
76
+        if (!isset($this->parser)) 
77 77
         {
78 78
             $this->parser = new Mailcode_Parser($this);
79 79
         }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     */
90 90
     public function getCommands() : Mailcode_Commands
91 91
     {
92
-        if(!isset($this->commands)) 
92
+        if (!isset($this->commands)) 
93 93
         {
94 94
             $this->commands = new Mailcode_Commands();
95 95
         }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     
116 116
     public function createVariables() : Mailcode_Variables
117 117
     {
118
-        if(!isset($this->variables))
118
+        if (!isset($this->variables))
119 119
         {
120 120
             $this->variables = new Mailcode_Variables();
121 121
         }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     */
132 132
     public function createTranslator() : Mailcode_Translator
133 133
     {
134
-        if(!isset($this->translator))
134
+        if (!isset($this->translator))
135 135
         {
136 136
             $this->translator = new Mailcode_Translator(); 
137 137
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         
74 74
         $total = count($matches[0]);
75 75
         
76
-        for($i=0; $i < $total; $i++)
76
+        for ($i = 0; $i < $total; $i++)
77 77
         {
78 78
             $match = $this->parseMatch($matches, $i);
79 79
             
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     
86 86
     protected function prepareString(string $subject) : string
87 87
     {
88
-        if(!ConvertHelper::isStringHTML($subject))
88
+        if (!ConvertHelper::isStringHTML($subject))
89 89
         {
90 90
             return $subject;
91 91
         }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     {
107 107
         $name = $match->getName();
108 108
         
109
-        if(!$this->commands->nameExists($name))
109
+        if (!$this->commands->nameExists($name))
110 110
         {
111 111
             $collection->addErrorMessage(
112 112
                 $match->getMatchedString(),
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
             $match->getMatchedString()
124 124
         );
125 125
         
126
-        if($cmd->isValid())
126
+        if ($cmd->isValid())
127 127
         {
128 128
             $collection->addCommand($cmd);
129 129
             return;
@@ -153,16 +153,16 @@  discard block
 block discarded – undo
153 153
         // 5 = parameter type command, type
154 154
         // 6 = parameter type command, params
155 155
         
156
-        if(!empty($matches[1][$index]))
156
+        if (!empty($matches[1][$index]))
157 157
         {
158 158
             $name = $matches[1][$index];
159 159
         }
160
-        else if(!empty($matches[2][$index]))
160
+        else if (!empty($matches[2][$index]))
161 161
         {
162 162
             $name = $matches[2][$index];
163 163
             $params = $matches[3][$index];
164 164
         }
165
-        else if(!empty($matches[4][$index]))
165
+        else if (!empty($matches[4][$index]))
166 166
         {
167 167
             $name = $matches[4][$index];
168 168
             $type = $matches[5][$index];
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     
76 76
     public function getInfo() : Mailcode_Parser_Statement_Info
77 77
     {
78
-        if(isset($this->info))
78
+        if (isset($this->info))
79 79
         {
80 80
             return $this->info; 
81 81
         }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     
88 88
     protected function validate() : void
89 89
     {
90
-        if(!$this->tokenizer->hasTokens())
90
+        if (!$this->tokenizer->hasTokens())
91 91
         {
92 92
             $this->result->makeError(
93 93
                 t('Empty statement'),
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         
100 100
         $unknown = $this->tokenizer->getFirstUnknown();
101 101
         
102
-        if($unknown)
102
+        if ($unknown)
103 103
         {
104 104
             $this->result->makeError(
105 105
                t('Unquoted string literal found:').' ('.htmlspecialchars($unknown->getMatchedText()).')',
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command/Comment.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
         $this->paramsString = trim($this->paramsString);
26 26
         
27 27
         // automatically quote the parameters, since comments don't require any.
28
-        if(substr($this->paramsString, 0, 1) != '"')
28
+        if (substr($this->paramsString, 0, 1) != '"')
29 29
         {
30 30
             $this->paramsString = '"'.$this->paramsString.'"';
31 31
         }
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command/ShowSnippet.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
         $this->validate();
64 64
         
65
-        if(isset($this->variable))
65
+        if (isset($this->variable))
66 66
         {
67 67
             return $this->variable;
68 68
         }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
          $vars = $this->getVariables()->getGroupedByName();
94 94
          $amount = count($vars);
95 95
          
96
-         if($amount === 1)
96
+         if ($amount === 1)
97 97
          {
98 98
              $this->variable = array_pop($vars);
99 99
              return;
Please login to merge, or discard this patch.
src/Mailcode/Renderer.php 1 patch
Spacing   +13 added lines, -13 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
         
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         return $this->command2string(Mailcode_Factory::showSnippet($snippetName));
56 56
     }
57 57
     
58
-    public function setVar(string $variableName, string $value, bool $quoteValue=false) : string
58
+    public function setVar(string $variableName, string $value, bool $quoteValue = false) : string
59 59
     {
60 60
         return $this->command2string(Mailcode_Factory::setVar($variableName, $value, $quoteValue));
61 61
     }
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
         return $this->command2string(Mailcode_Factory::setVarString($variableName, $value));
66 66
     }
67 67
     
68
-    public function if(string $condition, string $type='') : string
68
+    public function if (string $condition, string $type = '') : string
69 69
     {
70
-        return $this->command2string(Mailcode_Factory::if($condition, $type));
70
+        return $this->command2string(Mailcode_Factory::if ($condition, $type));
71 71
     }
72 72
     
73
-    public function ifVar(string $variable, string $operand, string $value, bool $quoteValue=false) : string
73
+    public function ifVar(string $variable, string $operand, string $value, bool $quoteValue = false) : string
74 74
     {
75 75
         return $this->command2string(Mailcode_Factory::ifVar($variable, $operand, $value, $quoteValue));
76 76
     }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         return $this->command2string(Mailcode_Factory::ifVarString($variable, $operand, $value));
81 81
     }
82 82
     
83
-    public function ifVarEquals(string $variable, string $value, bool $quoteValue=false) : string
83
+    public function ifVarEquals(string $variable, string $value, bool $quoteValue = false) : string
84 84
     {
85 85
         return $this->command2string(Mailcode_Factory::ifVarEquals($variable, $value, $quoteValue));
86 86
     }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         return $this->command2string(Mailcode_Factory::ifVarEqualsString($variable, $value));    
91 91
     }
92 92
     
93
-    public function ifVarNotEquals(string $variable, string $value, bool $quoteValue=false) : string
93
+    public function ifVarNotEquals(string $variable, string $value, bool $quoteValue = false) : string
94 94
     {
95 95
         return $this->command2string(Mailcode_Factory::ifVarNotEquals($variable, $value, $quoteValue));
96 96
     }
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
         return $this->command2string(Mailcode_Factory::ifVarNotEqualsString($variable, $value));
101 101
     }
102 102
     
103
-    public function elseIf(string $condition, string $type='') : string
103
+    public function elseIf (string $condition, string $type = '') : string
104 104
     {
105
-        return $this->command2string(Mailcode_Factory::elseIf($condition, $type));
105
+        return $this->command2string(Mailcode_Factory::elseIf ($condition, $type));
106 106
     }
107 107
     
108
-    public function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue=false) : string
108
+    public function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue = false) : string
109 109
     {
110 110
         return $this->command2string(Mailcode_Factory::elseIfVar($variable, $operand, $value, $quoteValue));
111 111
     }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         return $this->command2string(Mailcode_Factory::elseIfVarString($variable, $operand, $value));
116 116
     }
117 117
     
118
-    public function elseIfVarEquals(string $variable, string $value, bool $quoteValue=false) : string
118
+    public function elseIfVarEquals(string $variable, string $value, bool $quoteValue = false) : string
119 119
     {
120 120
         return $this->command2string(Mailcode_Factory::elseIfVarEquals($variable, $value, $quoteValue));
121 121
     }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         return $this->command2string(Mailcode_Factory::elseIfVarEqualsString($variable, $value));
126 126
     }
127 127
     
128
-    public function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue=false) : string
128
+    public function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue = false) : string
129 129
     {
130 130
         return $this->command2string(Mailcode_Factory::elseIfVarNotEquals($variable, $value, $quoteValue));
131 131
     }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
     
153 153
     protected function command2string(Mailcode_Commands_Command $command) : string
154 154
     {
155
-        if($this->highlighted)
155
+        if ($this->highlighted)
156 156
         {
157 157
             return $command->getHighlighted();
158 158
         }
Please login to merge, or discard this patch.