@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | $val = $this->validator->createVariable()->setIndex(0); |
75 | 75 | |
76 | - if($val->isValid()) |
|
76 | + if ($val->isValid()) |
|
77 | 77 | { |
78 | 78 | $this->variableToken = $val->getToken(); |
79 | 79 | } |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | { |
91 | 91 | $tokens = $this->params->getInfo()->createPruner()->limitToOperands()->getTokens(); |
92 | 92 | |
93 | - foreach($tokens as $token) |
|
93 | + foreach ($tokens as $token) |
|
94 | 94 | { |
95 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
95 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
96 | 96 | { |
97 | 97 | $this->validateOperand($token); |
98 | 98 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | // ensure that the operand we have in the command is one of the |
110 | 110 | // allowed ones. |
111 | - if(!in_array($sign, $allowed)) |
|
111 | + if (!in_array($sign, $allowed)) |
|
112 | 112 | { |
113 | 113 | $this->validationResult->makeError( |
114 | 114 | t('The %1$s sign is not allowed in this command.', '<code>'.$sign.'</code>'), |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | { |
122 | 122 | $tokens = $this->getAssignmentTokens(); |
123 | 123 | |
124 | - if(empty($tokens)) |
|
124 | + if (empty($tokens)) |
|
125 | 125 | { |
126 | 126 | $this->validationResult->makeError( |
127 | 127 | t('No value assigned to the variable.'), |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | public function getVariable() : Mailcode_Variables_Variable |
134 | 134 | { |
135 | - if($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
135 | + if ($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
136 | 136 | { |
137 | 137 | return $this->variableToken->getVariable(); |
138 | 138 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $eq = array_shift($params); // equals sign |
157 | 157 | |
158 | 158 | // in case the equals sign was omitted. |
159 | - if(!$eq instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
159 | + if (!$eq instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
160 | 160 | { |
161 | 161 | array_unshift($params, $eq); |
162 | 162 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | $items = array(); |
172 | 172 | |
173 | - foreach($tokens as $token) |
|
173 | + foreach ($tokens as $token) |
|
174 | 174 | { |
175 | 175 | $items[] = $token->getNormalized(); |
176 | 176 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | $this->instantiator->checkCommand($cmd); |
36 | 36 | |
37 | - if($cmd instanceof Mailcode_Commands_Command_Comment) |
|
37 | + if ($cmd instanceof Mailcode_Commands_Command_Comment) |
|
38 | 38 | { |
39 | 39 | return $cmd; |
40 | 40 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | throw $this->instantiator->exceptionUnexpectedType('Comment', $cmd); |
43 | 43 | } |
44 | 44 | |
45 | - public function for(string $sourceVariable, string $loopVariable) : Mailcode_Commands_Command_For |
|
45 | + public function for (string $sourceVariable, string $loopVariable) : Mailcode_Commands_Command_For |
|
46 | 46 | { |
47 | 47 | $sourceVariable = '$'.ltrim($sourceVariable, '$'); |
48 | 48 | $loopVariable = '$'.ltrim($loopVariable, '$'); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | $this->instantiator->checkCommand($cmd); |
66 | 66 | |
67 | - if($cmd instanceof Mailcode_Commands_Command_For) |
|
67 | + if ($cmd instanceof Mailcode_Commands_Command_For) |
|
68 | 68 | { |
69 | 69 | return $cmd; |
70 | 70 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | public function getSourceVariable() : Mailcode_Variables_Variable |
90 | 90 | { |
91 | - if(isset($this->sourceVar)) |
|
91 | + if (isset($this->sourceVar)) |
|
92 | 92 | { |
93 | 93 | return $this->sourceVar->getVariable(); |
94 | 94 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | public function getLoopVariable() : Mailcode_Variables_Variable |
104 | 104 | { |
105 | - if(isset($this->loopVar)) |
|
105 | + if (isset($this->loopVar)) |
|
106 | 106 | { |
107 | 107 | return $this->loopVar->getVariable(); |
108 | 108 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $this->keyword = $info->getKeywordByIndex(1); |
123 | 123 | $this->sourceVar = $info->getVariableByIndex(2); |
124 | 124 | |
125 | - if(!$this->loopVar || !$this->keyword || !$this->sourceVar) |
|
125 | + if (!$this->loopVar || !$this->keyword || !$this->sourceVar) |
|
126 | 126 | { |
127 | 127 | $this->validationResult->makeError( |
128 | 128 | t('Not a valid for loop.').' '.t('Is the %1$s keyword missing?', 'in:'), |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | |
136 | 136 | protected function validateSyntax_keyword() : void |
137 | 137 | { |
138 | - if($this->keyword->isForIn()) |
|
138 | + if ($this->keyword->isForIn()) |
|
139 | 139 | { |
140 | 140 | return; |
141 | 141 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | protected function validateSyntax_variable_names() : void |
150 | 150 | { |
151 | - if($this->sourceVar->getVariable()->getFullName() !== $this->loopVar->getVariable()->getFullName()) |
|
151 | + if ($this->sourceVar->getVariable()->getFullName() !== $this->loopVar->getVariable()->getFullName()) |
|
152 | 152 | { |
153 | 153 | return; |
154 | 154 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @param string $formatString A date format string, or empty string for default. |
48 | 48 | * @return Mailcode_Commands_Command_ShowDate |
49 | 49 | */ |
50 | - public static function showDate(string $variableName, string $formatString="") : Mailcode_Commands_Command_ShowDate |
|
50 | + public static function showDate(string $variableName, string $formatString = "") : Mailcode_Commands_Command_ShowDate |
|
51 | 51 | { |
52 | 52 | return self::$commandSets->show()->showDate($variableName, $formatString); |
53 | 53 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @see Mailcode_Factory::ERROR_INVALID_COMMAND_CREATED |
76 | 76 | */ |
77 | - public static function setVar(string $variableName, string $value, bool $quoteValue=true) : Mailcode_Commands_Command_SetVariable |
|
77 | + public static function setVar(string $variableName, string $value, bool $quoteValue = true) : Mailcode_Commands_Command_SetVariable |
|
78 | 78 | { |
79 | 79 | return self::$commandSets->set()->setVar($variableName, $value, $quoteValue); |
80 | 80 | } |
@@ -107,12 +107,12 @@ discard block |
||
107 | 107 | return self::$commandSets->if()->end(); |
108 | 108 | } |
109 | 109 | |
110 | - public static function if(string $condition, string $type='') : Mailcode_Commands_Command_If |
|
110 | + public static function if (string $condition, string $type = '') : Mailcode_Commands_Command_If |
|
111 | 111 | { |
112 | 112 | return self::$commandSets->if()->if($condition, $type); |
113 | 113 | } |
114 | 114 | |
115 | - public static function ifVar(string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable |
|
115 | + public static function ifVar(string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If_Variable |
|
116 | 116 | { |
117 | 117 | return self::$commandSets->if()->ifVar($variable, $operand, $value, $quoteValue); |
118 | 118 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | return self::$commandSets->if()->ifVarString($variable, $operand, $value); |
123 | 123 | } |
124 | 124 | |
125 | - public static function ifVarEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable |
|
125 | + public static function ifVarEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If_Variable |
|
126 | 126 | { |
127 | 127 | return self::$commandSets->if()->ifVarEquals($variable, $value, $quoteValue); |
128 | 128 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | return self::$commandSets->if()->ifVarEqualsString($variable, $value); |
133 | 133 | } |
134 | 134 | |
135 | - public static function ifVarNotEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable |
|
135 | + public static function ifVarNotEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If_Variable |
|
136 | 136 | { |
137 | 137 | return self::$commandSets->if()->ifVarNotEquals($variable, $value, $quoteValue); |
138 | 138 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | return self::$commandSets->if()->ifVarNotEqualsString($variable, $value); |
143 | 143 | } |
144 | 144 | |
145 | - public static function elseIf(string $condition, string $type='') : Mailcode_Commands_Command_ElseIf |
|
145 | + public static function elseIf (string $condition, string $type = '') : Mailcode_Commands_Command_ElseIf |
|
146 | 146 | { |
147 | 147 | return self::$commandSets->elseIf()->elseIf($condition, $type); |
148 | 148 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | return self::$commandSets->elseIf()->elseIfNotEmpty($variable); |
158 | 158 | } |
159 | 159 | |
160 | - public static function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable |
|
160 | + public static function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable |
|
161 | 161 | { |
162 | 162 | return self::$commandSets->elseIf()->elseIfVar($variable, $operand, $value, $quoteValue); |
163 | 163 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | return self::$commandSets->elseIf()->elseIfVarString($variable, $operand, $value); |
168 | 168 | } |
169 | 169 | |
170 | - public static function elseIfVarEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable |
|
170 | + public static function elseIfVarEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable |
|
171 | 171 | { |
172 | 172 | return self::$commandSets->elseIf()->elseIfVarEquals($variable, $value, $quoteValue); |
173 | 173 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | return self::$commandSets->elseIf()->elseIfVarEqualsString($variable, $value); |
178 | 178 | } |
179 | 179 | |
180 | - public static function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable |
|
180 | + public static function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable |
|
181 | 181 | { |
182 | 182 | return self::$commandSets->elseIf()->elseIfVarNotEquals($variable, $value, $quoteValue); |
183 | 183 | } |
@@ -187,27 +187,27 @@ discard block |
||
187 | 187 | return self::$commandSets->elseIf()->elseIfVarNotEqualsString($variable, $value); |
188 | 188 | } |
189 | 189 | |
190 | - public static function ifBeginsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_BeginsWith |
|
190 | + public static function ifBeginsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_BeginsWith |
|
191 | 191 | { |
192 | 192 | return self::$commandSets->if()->ifBeginsWith($variable, $search, $caseInsensitive); |
193 | 193 | } |
194 | 194 | |
195 | - public static function ifEndsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_EndsWith |
|
195 | + public static function ifEndsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_EndsWith |
|
196 | 196 | { |
197 | 197 | return self::$commandSets->if()->ifEndsWith($variable, $search, $caseInsensitive); |
198 | 198 | } |
199 | 199 | |
200 | - public static function elseIfBeginsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_BeginsWith |
|
200 | + public static function elseIfBeginsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_BeginsWith |
|
201 | 201 | { |
202 | 202 | return self::$commandSets->elseIf()->elseIfBeginsWith($variable, $search, $caseInsensitive); |
203 | 203 | } |
204 | 204 | |
205 | - public static function elseIfEndsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_EndsWith |
|
205 | + public static function elseIfEndsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_EndsWith |
|
206 | 206 | { |
207 | 207 | return self::$commandSets->elseIf()->elseIfEndsWith($variable, $search, $caseInsensitive); |
208 | 208 | } |
209 | 209 | |
210 | - public static function ifContains(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_Contains |
|
210 | + public static function ifContains(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_Contains |
|
211 | 211 | { |
212 | 212 | return self::$commandSets->if()->ifContains($variable, array($search), $caseInsensitive); |
213 | 213 | } |
@@ -220,12 +220,12 @@ discard block |
||
220 | 220 | * @param bool $caseInsensitive |
221 | 221 | * @return Mailcode_Commands_Command_If_Contains |
222 | 222 | */ |
223 | - public static function ifContainsAny(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_Contains |
|
223 | + public static function ifContainsAny(string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_Contains |
|
224 | 224 | { |
225 | 225 | return self::$commandSets->if()->ifContains($variable, $searchTerms, $caseInsensitive); |
226 | 226 | } |
227 | 227 | |
228 | - public static function elseIfContains(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_Contains |
|
228 | + public static function elseIfContains(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_Contains |
|
229 | 229 | { |
230 | 230 | return self::$commandSets->elseIf()->elseIfContains($variable, array($search), $caseInsensitive); |
231 | 231 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * @param bool $caseInsensitive |
239 | 239 | * @return Mailcode_Commands_Command_ElseIf_Contains |
240 | 240 | */ |
241 | - public static function elseIfContainsAny(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_Contains |
|
241 | + public static function elseIfContainsAny(string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_Contains |
|
242 | 242 | { |
243 | 243 | return self::$commandSets->elseIf()->elseIfContains($variable, $searchTerms, $caseInsensitive); |
244 | 244 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | return self::$commandSets->if()->ifNotEmpty($variable); |
254 | 254 | } |
255 | 255 | |
256 | - public static function for(string $sourceVariable, string $loopVariable) : Mailcode_Commands_Command_For |
|
256 | + public static function for (string $sourceVariable, string $loopVariable) : Mailcode_Commands_Command_For |
|
257 | 257 | { |
258 | 258 | return self::$commandSets->misc()->for($sourceVariable, $loopVariable); |
259 | 259 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | |
294 | 294 | public static function init() : void |
295 | 295 | { |
296 | - if(!isset(self::$commandSets)) |
|
296 | + if (!isset(self::$commandSets)) |
|
297 | 297 | { |
298 | 298 | self::$commandSets = new Mailcode_Factory_CommandSets(); |
299 | 299 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | $tagName = strtolower($tagName); |
44 | 44 | |
45 | - if(!in_array($tagName, $this->excludeTags)) |
|
45 | + if (!in_array($tagName, $this->excludeTags)) |
|
46 | 46 | { |
47 | 47 | $this->excludeTags[] = $tagName; |
48 | 48 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function excludeTags(array $tagNames) : Mailcode_Parser_Safeguard_Formatter_Type_HTMLHighlighting |
60 | 60 | { |
61 | - foreach($tagNames as $tagName) |
|
61 | + foreach ($tagNames as $tagName) |
|
62 | 62 | { |
63 | 63 | $this->excludeTag((string)$tagName); |
64 | 64 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | |
33 | 33 | public function requiresAdjustment(): bool |
34 | 34 | { |
35 | - if(!parent::requiresAdjustment()) |
|
35 | + if (!parent::requiresAdjustment()) |
|
36 | 36 | { |
37 | 37 | return false; |
38 | 38 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | { |
54 | 54 | $pos = $this->getStartPosition(); |
55 | 55 | |
56 | - if(is_bool($pos)) |
|
56 | + if (is_bool($pos)) |
|
57 | 57 | { |
58 | 58 | return ''; |
59 | 59 | } |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | { |
76 | 76 | $tagNames = $this->getParentTags(); |
77 | 77 | |
78 | - foreach($tagNames as $tagName) |
|
78 | + foreach ($tagNames as $tagName) |
|
79 | 79 | { |
80 | - if($this->formatter->isTagExcluded($tagName)) |
|
80 | + if ($this->formatter->isTagExcluded($tagName)) |
|
81 | 81 | { |
82 | 82 | return true; |
83 | 83 | } |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | // Create a stack of all direct parent tags of the command. |
100 | 100 | // Handles closing tags as well. |
101 | 101 | $stack = array(); |
102 | - foreach($tags[2] as $idx => $tagName) |
|
102 | + foreach ($tags[2] as $idx => $tagName) |
|
103 | 103 | { |
104 | 104 | $closing = $tags[1][$idx] === '/'; |
105 | 105 | |
106 | - if($closing) |
|
106 | + if ($closing) |
|
107 | 107 | { |
108 | 108 | array_pop($stack); |
109 | 109 | } |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | |
129 | 129 | // This check is easy: if the command is in the attribute |
130 | 130 | // of any of the tags, we will find the command marker in there. |
131 | - foreach($tags[3] as $attributes) |
|
131 | + foreach ($tags[3] as $attributes) |
|
132 | 132 | { |
133 | - if(strstr($attributes, self::COMMAND_MARKER)) |
|
133 | + if (strstr($attributes, self::COMMAND_MARKER)) |
|
134 | 134 | { |
135 | 135 | return true; |
136 | 136 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | private function getTagAncestry() : array |
143 | 143 | { |
144 | - if($this->ancestryChecked) |
|
144 | + if ($this->ancestryChecked) |
|
145 | 145 | { |
146 | 146 | return $this->tagAncestry; |
147 | 147 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | |
41 | 41 | public function setTemplate(string $template) : void |
42 | 42 | { |
43 | - if(substr_count($template, '%s') !== 1) |
|
43 | + if (substr_count($template, '%s') !== 1) |
|
44 | 44 | { |
45 | 45 | throw new Mailcode_Exception( |
46 | 46 | 'Invalid tag template', |
@@ -84,23 +84,23 @@ discard block |
||
84 | 84 | |
85 | 85 | $placeholderID = $this->placeholder->getID(); |
86 | 86 | |
87 | - foreach($placeholders as $placeholder) |
|
87 | + foreach ($placeholders as $placeholder) |
|
88 | 88 | { |
89 | - if($placeholder->getID() === $placeholderID) |
|
89 | + if ($placeholder->getID() === $placeholderID) |
|
90 | 90 | { |
91 | 91 | continue; |
92 | 92 | } |
93 | 93 | |
94 | 94 | $start = $this->subject->getSubstrPosition($placeholder->getReplacementText()); |
95 | 95 | |
96 | - if($start === false) |
|
96 | + if ($start === false) |
|
97 | 97 | { |
98 | 98 | continue; |
99 | 99 | } |
100 | 100 | |
101 | 101 | $end = $start + $placeholder->getLength(); |
102 | 102 | |
103 | - if($position >= $start && $position <= $end) |
|
103 | + if ($position >= $start && $position <= $end) |
|
104 | 104 | { |
105 | 105 | return true; |
106 | 106 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | { |
117 | 117 | $start = $this->getStartPosition(); |
118 | 118 | |
119 | - if($start !== false) |
|
119 | + if ($start !== false) |
|
120 | 120 | { |
121 | 121 | return $start + $this->placeholder->getLength(); |
122 | 122 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | { |
147 | 147 | $needle = $this->placeholder->getReplacementText(); |
148 | 148 | |
149 | - if($this->subject->replaceSubstrings($needle, $replacementText)) |
|
149 | + if ($this->subject->replaceSubstrings($needle, $replacementText)) |
|
150 | 150 | { |
151 | 151 | return; |
152 | 152 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | public function format() : void |
165 | 165 | { |
166 | - if($this->requiresAdjustment() && (!empty($this->prepend) || !empty($this->append))) |
|
166 | + if ($this->requiresAdjustment() && (!empty($this->prepend) || !empty($this->append))) |
|
167 | 167 | { |
168 | 168 | $this->replaceWith(sprintf( |
169 | 169 | '%s%s%s', |