@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function getVariable() : ?Mailcode_Variables_Variable |
66 | 66 | { |
67 | - if(isset($this->variable)) |
|
67 | + if (isset($this->variable)) |
|
68 | 68 | { |
69 | 69 | return $this->variable; |
70 | 70 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | { |
77 | 77 | $amount = $this->getVariables()->countVariables(); |
78 | 78 | |
79 | - if($amount >= 1) |
|
79 | + if ($amount >= 1) |
|
80 | 80 | { |
81 | 81 | return; |
82 | 82 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | { |
92 | 92 | $validations = array(); |
93 | 93 | |
94 | - if($this->getType() === 'variable') |
|
94 | + if ($this->getType() === 'variable') |
|
95 | 95 | { |
96 | 96 | $validations[] = 'require_variable'; |
97 | 97 | } |
@@ -62,7 +62,7 @@ |
||
62 | 62 | $keyword = $info->getKeywordByIndex(1); |
63 | 63 | $container = $info->getVariableByIndex(2); |
64 | 64 | |
65 | - if($variable && $keyword && $container && $keyword->isForIn()) |
|
65 | + if ($variable && $keyword && $container && $keyword->isForIn()) |
|
66 | 66 | { |
67 | 67 | return; |
68 | 68 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | { |
52 | 52 | $this->parts[] = $this->renderTag(array('command-name'), $this->command->getName()); |
53 | 53 | |
54 | - if($this->command->hasType()) |
|
54 | + if ($this->command->hasType()) |
|
55 | 55 | { |
56 | 56 | $this->parts[] = ' '.$this->renderTag(array('command-type'), $this->command->getType()); |
57 | 57 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | protected function appendParams() : void |
64 | 64 | { |
65 | - if($this->command->hasParameters()) |
|
65 | + if ($this->command->hasParameters()) |
|
66 | 66 | { |
67 | 67 | $this->parts[] = ' '.$this->renderTag(array('params'), $this->command->getParamsString()); |
68 | 68 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | { |
78 | 78 | $parts = array(); |
79 | 79 | |
80 | - foreach($classes as $class) |
|
80 | + foreach ($classes as $class) |
|
81 | 81 | { |
82 | 82 | $parts[] = 'mailcode-'.$class; |
83 | 83 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $operand = $this->getOperandByIndex(1); |
49 | 49 | $value = $this->getTokenByIndex(2); |
50 | 50 | |
51 | - if($variable && $operand && $value && $operand->isAssignment()) |
|
51 | + if ($variable && $operand && $value && $operand->isAssignment()) |
|
52 | 52 | { |
53 | 53 | return true; |
54 | 54 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $operand = $this->getOperandByIndex(1); |
68 | 68 | $value = $this->getTokenByIndex(2); |
69 | 69 | |
70 | - if($variable && $operand && $value && $operand->isComparator()) |
|
70 | + if ($variable && $operand && $value && $operand->isComparator()) |
|
71 | 71 | { |
72 | 72 | return true; |
73 | 73 | } |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | { |
85 | 85 | $result = array(); |
86 | 86 | |
87 | - foreach($this->tokens as $token) |
|
87 | + foreach ($this->tokens as $token) |
|
88 | 88 | { |
89 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
89 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
90 | 90 | { |
91 | 91 | $result[] = $token->getVariable(); |
92 | 92 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | { |
100 | 100 | $token = $this->getTokenByIndex($index); |
101 | 101 | |
102 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
102 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
103 | 103 | { |
104 | 104 | return $token; |
105 | 105 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | { |
112 | 112 | $token = $this->getTokenByIndex($index); |
113 | 113 | |
114 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
114 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
115 | 115 | { |
116 | 116 | return $token; |
117 | 117 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | { |
124 | 124 | $token = $this->getTokenByIndex($index); |
125 | 125 | |
126 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
126 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
127 | 127 | { |
128 | 128 | return $token; |
129 | 129 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | |
134 | 134 | public function getTokenByIndex(int $index) : ?Mailcode_Parser_Statement_Tokenizer_Token |
135 | 135 | { |
136 | - if(isset($this->tokens[$index])) |
|
136 | + if (isset($this->tokens[$index])) |
|
137 | 137 | { |
138 | 138 | return $this->tokens[$index]; |
139 | 139 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | public function getVariable() : Mailcode_Variables_Variable |
26 | 26 | { |
27 | - if($this->subject instanceof Mailcode_Variables_Variable) |
|
27 | + if ($this->subject instanceof Mailcode_Variables_Variable) |
|
28 | 28 | { |
29 | 29 | return $this->subject; |
30 | 30 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | * @param string $matchedText |
41 | 41 | * @param mixed $subject |
42 | 42 | */ |
43 | - public function __construct(string $tokenID, string $matchedText, $subject=null) |
|
43 | + public function __construct(string $tokenID, string $matchedText, $subject = null) |
|
44 | 44 | { |
45 | 45 | $this->tokenID = $tokenID; |
46 | 46 | $this->matchedText = $matchedText; |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | { |
135 | 135 | $result = array(); |
136 | 136 | |
137 | - foreach($this->tokensOrdered as $token) |
|
137 | + foreach ($this->tokensOrdered as $token) |
|
138 | 138 | { |
139 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Unknown) |
|
139 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Unknown) |
|
140 | 140 | { |
141 | 141 | $result[] = $token; |
142 | 142 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | { |
150 | 150 | $unknown = $this->getUnknown(); |
151 | 151 | |
152 | - if(!empty($unknown)) |
|
152 | + if (!empty($unknown)) |
|
153 | 153 | { |
154 | 154 | return array_shift($unknown); |
155 | 155 | } |
@@ -161,11 +161,11 @@ discard block |
||
161 | 161 | { |
162 | 162 | $parts = array(); |
163 | 163 | |
164 | - foreach($this->tokensOrdered as $token) |
|
164 | + foreach ($this->tokensOrdered as $token) |
|
165 | 165 | { |
166 | 166 | $string = $token->getNormalized(); |
167 | 167 | |
168 | - if(!empty($string)) |
|
168 | + if (!empty($string)) |
|
169 | 169 | { |
170 | 170 | $parts[] = $string; |
171 | 171 | } |
@@ -178,11 +178,11 @@ discard block |
||
178 | 178 | { |
179 | 179 | $this->tokenized = trim($statement); |
180 | 180 | |
181 | - foreach($this->tokenCategories as $token) |
|
181 | + foreach ($this->tokenCategories as $token) |
|
182 | 182 | { |
183 | 183 | $method = 'tokenize_'.$token; |
184 | 184 | |
185 | - if(!method_exists($this, $method)) |
|
185 | + if (!method_exists($this, $method)) |
|
186 | 186 | { |
187 | 187 | throw new Mailcode_Exception( |
188 | 188 | 'Unknown statement token.', |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * @param string $matchedText |
207 | 207 | * @param mixed $subject |
208 | 208 | */ |
209 | - protected function registerToken(string $type, string $matchedText, $subject=null) : void |
|
209 | + protected function registerToken(string $type, string $matchedText, $subject = null) : void |
|
210 | 210 | { |
211 | 211 | $tokenID = $this->generateID(); |
212 | 212 | |
@@ -223,9 +223,9 @@ discard block |
||
223 | 223 | |
224 | 224 | protected function getTokenByID(string $tokenID) : ?Mailcode_Parser_Statement_Tokenizer_Token |
225 | 225 | { |
226 | - foreach($this->tokensTemporary as $token) |
|
226 | + foreach ($this->tokensTemporary as $token) |
|
227 | 227 | { |
228 | - if($token->getID() === $tokenID) |
|
228 | + if ($token->getID() === $tokenID) |
|
229 | 229 | { |
230 | 230 | return $token; |
231 | 231 | } |
@@ -241,9 +241,9 @@ discard block |
||
241 | 241 | |
242 | 242 | protected function tokenize_keywords() : void |
243 | 243 | { |
244 | - foreach($this->keywords as $keyword) |
|
244 | + foreach ($this->keywords as $keyword) |
|
245 | 245 | { |
246 | - if(strstr($this->tokenized, $keyword)) |
|
246 | + if (strstr($this->tokenized, $keyword)) |
|
247 | 247 | { |
248 | 248 | $this->registerToken('Keyword', $keyword); |
249 | 249 | } |
@@ -257,12 +257,12 @@ discard block |
||
257 | 257 | // over that could not be tokenized. |
258 | 258 | $parts = \AppUtils\ConvertHelper::explodeTrim($this->delimiter, $this->tokenized); |
259 | 259 | |
260 | - foreach($parts as $part) |
|
260 | + foreach ($parts as $part) |
|
261 | 261 | { |
262 | 262 | $token = $this->getTokenByID($part); |
263 | 263 | |
264 | 264 | // if the entry is a token, simply add it. |
265 | - if($token) |
|
265 | + if ($token) |
|
266 | 266 | { |
267 | 267 | $this->tokensOrdered[] = $token; |
268 | 268 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | { |
279 | 279 | $vars = Mailcode::create()->findVariables($this->tokenized)->getGroupedByHash(); |
280 | 280 | |
281 | - foreach($vars as $var) |
|
281 | + foreach ($vars as $var) |
|
282 | 282 | { |
283 | 283 | $this->registerToken('Variable', $var->getMatchedText(), $var); |
284 | 284 | } |
@@ -286,9 +286,9 @@ discard block |
||
286 | 286 | |
287 | 287 | protected function tokenize_operands() : void |
288 | 288 | { |
289 | - foreach($this->operands as $operand) |
|
289 | + foreach ($this->operands as $operand) |
|
290 | 290 | { |
291 | - if(strstr($this->tokenized, $operand)) |
|
291 | + if (strstr($this->tokenized, $operand)) |
|
292 | 292 | { |
293 | 293 | $this->registerToken('Operand', $operand); |
294 | 294 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | $matches = array(); |
301 | 301 | preg_match_all('/"(.*)"/sx', $this->tokenized, $matches, PREG_PATTERN_ORDER); |
302 | 302 | |
303 | - foreach($matches[0] as $match) |
|
303 | + foreach ($matches[0] as $match) |
|
304 | 304 | { |
305 | 305 | $this->registerToken('StringLiteral', $match); |
306 | 306 | } |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | $matches = array(); |
312 | 312 | preg_match_all('/-*[0-9]+\s*[.,]\s*[0-9]+|-*[0-9]+/sx', $this->tokenized, $matches, PREG_PATTERN_ORDER); |
313 | 313 | |
314 | - foreach($matches[0] as $match) |
|
314 | + foreach ($matches[0] as $match) |
|
315 | 315 | { |
316 | 316 | $this->registerToken('Number', $match); |
317 | 317 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | { |
329 | 329 | static $alphas; |
330 | 330 | |
331 | - if(!isset($alphas)) |
|
331 | + if (!isset($alphas)) |
|
332 | 332 | { |
333 | 333 | $alphas = range('A', 'Z'); |
334 | 334 | } |
@@ -337,12 +337,12 @@ discard block |
||
337 | 337 | |
338 | 338 | $result = ''; |
339 | 339 | |
340 | - for($i=0; $i < $amount; $i++) |
|
340 | + for ($i = 0; $i < $amount; $i++) |
|
341 | 341 | { |
342 | 342 | $result .= $alphas[array_rand($alphas)]; |
343 | 343 | } |
344 | 344 | |
345 | - if(!in_array($result, self::$ids)) |
|
345 | + if (!in_array($result, self::$ids)) |
|
346 | 346 | { |
347 | 347 | self::$ids[] = $result; |
348 | 348 | return $result; |
@@ -75,7 +75,7 @@ discard block |
||
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 |
||
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 |
||
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:').' ('.$unknown->getMatchedText().')', |
@@ -32,7 +32,7 @@ |
||
32 | 32 | * @param \Exception|NULL $previous |
33 | 33 | * @param Mailcode_Commands_Command|NULL $command |
34 | 34 | */ |
35 | - public function __construct(string $message, $details=null, $code=null, $previous=null, Mailcode_Commands_Command $command=null) |
|
35 | + public function __construct(string $message, $details = null, $code = null, $previous = null, Mailcode_Commands_Command $command = null) |
|
36 | 36 | { |
37 | 37 | parent::__construct($message, $details, $code, $previous); |
38 | 38 |