@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $command->getID() |
| 65 | 65 | ); |
| 66 | 66 | |
| 67 | - if(!class_exists($class)) |
|
| 67 | + if (!class_exists($class)) |
|
| 68 | 68 | { |
| 69 | 69 | throw new Mailcode_Translator_Exception( |
| 70 | 70 | sprintf('Unknown command %s in translator', $command->getID()), |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | { |
| 93 | 93 | $subject = $safeguard->makeSafe(); |
| 94 | 94 | |
| 95 | - if(!$safeguard->hasPlaceholders()) |
|
| 95 | + if (!$safeguard->hasPlaceholders()) |
|
| 96 | 96 | { |
| 97 | 97 | return $subject; |
| 98 | 98 | } |
@@ -101,13 +101,13 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | $replaces = array(); |
| 103 | 103 | |
| 104 | - foreach($placeholders as $placeholder) |
|
| 104 | + foreach ($placeholders as $placeholder) |
|
| 105 | 105 | { |
| 106 | 106 | $command = $placeholder->getCommand(); |
| 107 | 107 | |
| 108 | 108 | $replaces[$placeholder->getReplacementText()] = $this->translateCommand($command); |
| 109 | 109 | |
| 110 | - if($command instanceof Mailcode_Interfaces_Commands_ProtectedContent) |
|
| 110 | + if ($command instanceof Mailcode_Interfaces_Commands_ProtectedContent) |
|
| 111 | 111 | { |
| 112 | 112 | $replaces[$command->getContentPlaceholder()] = $command->getContent(); |
| 113 | 113 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $varName = ltrim($command->getVariableName(), '$'); |
| 26 | 26 | |
| 27 | 27 | // Automatically URL escape the variable if it's in an URL. |
| 28 | - if($command->isURLEncoded()) |
|
| 28 | + if ($command->isURLEncoded()) |
|
| 29 | 29 | { |
| 30 | 30 | return sprintf( |
| 31 | 31 | '${esc.url($%s)}', |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | ); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - if($command->isURLDecoded()) |
|
| 36 | + if ($command->isURLDecoded()) |
|
| 37 | 37 | { |
| 38 | 38 | return sprintf( |
| 39 | 39 | '${esc.unurl($%s)}', |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | // IF type. |
| 40 | 40 | $method = 'translate'.$this->getIfType($command); |
| 41 | 41 | |
| 42 | - if(method_exists($this, $method)) |
|
| 42 | + if (method_exists($this, $method)) |
|
| 43 | 43 | { |
| 44 | 44 | return strval($this->$method($command)); |
| 45 | 45 | } |
@@ -53,11 +53,11 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | $keywords = $command->getLogicKeywords()->getKeywords(); |
| 55 | 55 | |
| 56 | - foreach($keywords as $keyword) |
|
| 56 | + foreach ($keywords as $keyword) |
|
| 57 | 57 | { |
| 58 | 58 | $keyCommand = $keyword->getCommand(); |
| 59 | 59 | |
| 60 | - if($keyCommand instanceof Mailcode_Commands_IfBase) |
|
| 60 | + if ($keyCommand instanceof Mailcode_Commands_IfBase) |
|
| 61 | 61 | { |
| 62 | 62 | $body .= ' '.$this->getSign($keyword).' '.$this->translateBody($keyCommand); |
| 63 | 63 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | protected function getSign(Mailcode_Commands_LogicKeywords_Keyword $keyword) : string |
| 82 | 82 | { |
| 83 | - switch($keyword->getName()) |
|
| 83 | + switch ($keyword->getName()) |
|
| 84 | 84 | { |
| 85 | 85 | case 'and': |
| 86 | 86 | return '&&'; |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | { |
| 118 | 118 | $sign = ''; |
| 119 | 119 | |
| 120 | - if($notEmpty) |
|
| 120 | + if ($notEmpty) |
|
| 121 | 121 | { |
| 122 | 122 | $sign = '!'; |
| 123 | 123 | } |
@@ -133,12 +133,12 @@ discard block |
||
| 133 | 133 | { |
| 134 | 134 | $params = $command->getParams(); |
| 135 | 135 | |
| 136 | - if(!$params) |
|
| 136 | + if (!$params) |
|
| 137 | 137 | { |
| 138 | 138 | return ''; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - if($command->hasFreeformParameters()) |
|
| 141 | + if ($command->hasFreeformParameters()) |
|
| 142 | 142 | { |
| 143 | 143 | return $params->getStatementString(); |
| 144 | 144 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | $test = strtolower(trim($value, '"')); |
| 152 | 152 | $fullName = $variable->getFullName(); |
| 153 | 153 | |
| 154 | - if(in_array($test, array('true', 'false'))) |
|
| 154 | + if (in_array($test, array('true', 'false'))) |
|
| 155 | 155 | { |
| 156 | 156 | $fullName .= '.toLowerCase()'; |
| 157 | 157 | $value = '"'.$test.'"'; |
@@ -178,12 +178,12 @@ discard block |
||
| 178 | 178 | $varName = $variable->getFullName(); |
| 179 | 179 | |
| 180 | 180 | $opts = 's'; |
| 181 | - if($caseSensitive) |
|
| 181 | + if ($caseSensitive) |
|
| 182 | 182 | { |
| 183 | 183 | $opts = 'is'; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - foreach($searchTerms as $token) |
|
| 186 | + foreach ($searchTerms as $token) |
|
| 187 | 187 | { |
| 188 | 188 | $parts[] = sprintf( |
| 189 | 189 | '%s.matches("(?%s)%s")', |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | protected function _translateSearch(string $mode, Mailcode_Variables_Variable $variable, bool $caseSensitive, string $searchTerm) : string |
| 200 | 200 | { |
| 201 | 201 | $method = $mode.'With'; |
| 202 | - if($caseSensitive) |
|
| 202 | + if ($caseSensitive) |
|
| 203 | 203 | { |
| 204 | 204 | $method = $mode.'WithIgnoreCase'; |
| 205 | 205 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $varName |
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | - if($command->isURLEncoded()) |
|
| 37 | + if ($command->isURLEncoded()) |
|
| 38 | 38 | { |
| 39 | 39 | return sprintf( |
| 40 | 40 | '${esc.url($%s)}', |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | ); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if($command->isURLDecoded()) |
|
| 45 | + if ($command->isURLDecoded()) |
|
| 46 | 46 | { |
| 47 | 47 | return sprintf( |
| 48 | 48 | '${esc.unurl($%s)}', |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function createSyntax(string $name) : Mailcode_Translator_Syntax |
| 34 | 34 | { |
| 35 | - if($this->syntaxExists($name)) |
|
| 35 | + if ($this->syntaxExists($name)) |
|
| 36 | 36 | { |
| 37 | 37 | return new Mailcode_Translator_Syntax($name); |
| 38 | 38 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $names = $this->getSyntaxNames(); |
| 60 | 60 | $result = array(); |
| 61 | 61 | |
| 62 | - foreach($names as $name) |
|
| 62 | + foreach ($names as $name) |
|
| 63 | 63 | { |
| 64 | 64 | $result[] = $this->createSyntax($name); |
| 65 | 65 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | protected $freeform = false; |
| 53 | 53 | |
| 54 | - public function __construct(string $statement, bool $freeform=false) |
|
| 54 | + public function __construct(string $statement, bool $freeform = false) |
|
| 55 | 55 | { |
| 56 | 56 | $this->statement = $statement; |
| 57 | 57 | $this->result = new OperationResult($this); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | public function getInfo() : Mailcode_Parser_Statement_Info |
| 82 | 82 | { |
| 83 | - if($this->info instanceof Mailcode_Parser_Statement_Info) |
|
| 83 | + if ($this->info instanceof Mailcode_Parser_Statement_Info) |
|
| 84 | 84 | { |
| 85 | 85 | return $this->info; |
| 86 | 86 | } |
@@ -92,12 +92,12 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | protected function validate() : void |
| 94 | 94 | { |
| 95 | - if($this->freeform) |
|
| 95 | + if ($this->freeform) |
|
| 96 | 96 | { |
| 97 | 97 | return; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if(!$this->tokenizer->hasTokens()) |
|
| 100 | + if (!$this->tokenizer->hasTokens()) |
|
| 101 | 101 | { |
| 102 | 102 | $this->result->makeError( |
| 103 | 103 | t('Empty statement'), |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | $unknown = $this->tokenizer->getFirstUnknown(); |
| 111 | 111 | |
| 112 | - if($unknown) |
|
| 112 | + if ($unknown) |
|
| 113 | 113 | { |
| 114 | 114 | $this->result->makeError( |
| 115 | 115 | t('Unquoted string literal found:').' ('.htmlspecialchars($unknown->getMatchedText()).')', |
@@ -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 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | { |
| 108 | 108 | $token = $this->getTokenByIndex($index); |
| 109 | 109 | |
| 110 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
| 110 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
| 111 | 111 | { |
| 112 | 112 | return $token; |
| 113 | 113 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | { |
| 128 | 128 | $token = $this->getTokenByIndex($index); |
| 129 | 129 | |
| 130 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral) |
|
| 130 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral) |
|
| 131 | 131 | { |
| 132 | 132 | return $token; |
| 133 | 133 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | { |
| 148 | 148 | $token = $this->getTokenByIndex($index); |
| 149 | 149 | |
| 150 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 150 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 151 | 151 | { |
| 152 | 152 | return $token; |
| 153 | 153 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | { |
| 168 | 168 | $token = $this->getTokenByIndex($index); |
| 169 | 169 | |
| 170 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
| 170 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
| 171 | 171 | { |
| 172 | 172 | return $token; |
| 173 | 173 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | public function getTokenByIndex(int $index) : ?Mailcode_Parser_Statement_Tokenizer_Token |
| 187 | 187 | { |
| 188 | - if(isset($this->tokens[$index])) |
|
| 188 | + if (isset($this->tokens[$index])) |
|
| 189 | 189 | { |
| 190 | 190 | return $this->tokens[$index]; |
| 191 | 191 | } |
@@ -215,9 +215,9 @@ discard block |
||
| 215 | 215 | { |
| 216 | 216 | $result = array(); |
| 217 | 217 | |
| 218 | - foreach($this->tokens as $token) |
|
| 218 | + foreach ($this->tokens as $token) |
|
| 219 | 219 | { |
| 220 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral) |
|
| 220 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral) |
|
| 221 | 221 | { |
| 222 | 222 | $result[] = $token; |
| 223 | 223 | } |
@@ -238,9 +238,9 @@ discard block |
||
| 238 | 238 | { |
| 239 | 239 | $result = array(); |
| 240 | 240 | |
| 241 | - foreach($this->tokens as $token) |
|
| 241 | + foreach ($this->tokens as $token) |
|
| 242 | 242 | { |
| 243 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 243 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 244 | 244 | { |
| 245 | 245 | $result[] = $token; |
| 246 | 246 | } |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | public function setKeywordEnabled(string $keyword, bool $enabled) : Mailcode_Parser_Statement_Info |
| 261 | 261 | { |
| 262 | - if($enabled) |
|
| 262 | + if ($enabled) |
|
| 263 | 263 | { |
| 264 | 264 | return $this->addKeyword($keyword); |
| 265 | 265 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | { |
| 279 | 279 | $keyword = rtrim($keyword, ':').':'; |
| 280 | 280 | |
| 281 | - if(!$this->hasKeyword($keyword)) |
|
| 281 | + if (!$this->hasKeyword($keyword)) |
|
| 282 | 282 | { |
| 283 | 283 | $this->tokenizer->appendKeyword($keyword); |
| 284 | 284 | $this->tokens = $this->tokenizer->getTokens(); |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | |
| 326 | 326 | foreach ($keywords as $kw) |
| 327 | 327 | { |
| 328 | - if($kw->getKeyword() === $keyword) |
|
| 328 | + if ($kw->getKeyword() === $keyword) |
|
| 329 | 329 | { |
| 330 | 330 | return true; |
| 331 | 331 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | public function setDelimiter(string $delimiter) : Mailcode_Parser_Safeguard |
| 130 | 130 | { |
| 131 | - if(empty($delimiter)) |
|
| 131 | + if (empty($delimiter)) |
|
| 132 | 132 | { |
| 133 | 133 | throw new Mailcode_Exception( |
| 134 | 134 | 'Empty delimiter', |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $placeholders = $this->getPlaceholders(); |
| 179 | 179 | $string = $this->originalString; |
| 180 | 180 | |
| 181 | - foreach($placeholders as $placeholder) |
|
| 181 | + foreach ($placeholders as $placeholder) |
|
| 182 | 182 | { |
| 183 | 183 | $string = $this->makePlaceholderSafe($string, $placeholder); |
| 184 | 184 | } |
@@ -208,14 +208,14 @@ discard block |
||
| 208 | 208 | $placeholders = $this->getPlaceholders(); |
| 209 | 209 | $total = count($placeholders); |
| 210 | 210 | |
| 211 | - for($i=0; $i < $total; $i++) |
|
| 211 | + for ($i = 0; $i < $total; $i++) |
|
| 212 | 212 | { |
| 213 | 213 | $placeholder = $placeholders[$i]; |
| 214 | 214 | $command = $placeholder->getCommand(); |
| 215 | 215 | |
| 216 | - if($command instanceof Mailcode_Interfaces_Commands_ProtectedContent) |
|
| 216 | + if ($command instanceof Mailcode_Interfaces_Commands_ProtectedContent) |
|
| 217 | 217 | { |
| 218 | - $string = $command->protectContent($string, $placeholder, $placeholders[$i+1]); |
|
| 218 | + $string = $command->protectContent($string, $placeholder, $placeholders[$i + 1]); |
|
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | 221 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | { |
| 227 | 227 | $pos = mb_strpos($string, $placeholder->getOriginalText()); |
| 228 | 228 | |
| 229 | - if($pos === false) |
|
| 229 | + if ($pos === false) |
|
| 230 | 230 | { |
| 231 | 231 | throw new Mailcode_Exception( |
| 232 | 232 | 'Placeholder original text not found', |
@@ -258,18 +258,18 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | $placeholders = $this->getPlaceholders(); |
| 260 | 260 | |
| 261 | - foreach($urls as $url) |
|
| 261 | + foreach ($urls as $url) |
|
| 262 | 262 | { |
| 263 | - foreach($placeholders as $placeholder) |
|
| 263 | + foreach ($placeholders as $placeholder) |
|
| 264 | 264 | { |
| 265 | 265 | $command = $placeholder->getCommand(); |
| 266 | 266 | |
| 267 | - if(!$command->supportsURLEncoding()) |
|
| 267 | + if (!$command->supportsURLEncoding()) |
|
| 268 | 268 | { |
| 269 | 269 | continue; |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - if(strstr($url, $placeholder->getReplacementText())) |
|
| 272 | + if (strstr($url, $placeholder->getReplacementText())) |
|
| 273 | 273 | { |
| 274 | 274 | $command->setURLEncoding(true); |
| 275 | 275 | } |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | */ |
| 287 | 287 | public function createFormatting($subject) : Mailcode_Parser_Safeguard_Formatting |
| 288 | 288 | { |
| 289 | - if(is_string($subject)) |
|
| 289 | + if (is_string($subject)) |
|
| 290 | 290 | { |
| 291 | 291 | $subject = Mailcode::create()->createString($subject); |
| 292 | 292 | } |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | */ |
| 303 | 303 | public function getPlaceholders() |
| 304 | 304 | { |
| 305 | - if(isset($this->placeholders)) |
|
| 305 | + if (isset($this->placeholders)) |
|
| 306 | 306 | { |
| 307 | 307 | return $this->placeholders; |
| 308 | 308 | } |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | |
| 312 | 312 | $cmds = $this->getCollection()->getCommands(); |
| 313 | 313 | |
| 314 | - foreach($cmds as $command) |
|
| 314 | + foreach ($cmds as $command) |
|
| 315 | 315 | { |
| 316 | 316 | self::$counter++; |
| 317 | 317 | |
@@ -325,21 +325,21 @@ discard block |
||
| 325 | 325 | return $this->placeholders; |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | - protected function restore(string $string, bool $partial=false, bool $highlighted=false) : string |
|
| 328 | + protected function restore(string $string, bool $partial = false, bool $highlighted = false) : string |
|
| 329 | 329 | { |
| 330 | - if(!$partial) |
|
| 330 | + if (!$partial) |
|
| 331 | 331 | { |
| 332 | 332 | $this->requireValidCollection(); |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | $formatting = $this->createFormatting($string); |
| 336 | 336 | |
| 337 | - if($partial) |
|
| 337 | + if ($partial) |
|
| 338 | 338 | { |
| 339 | 339 | $formatting->makePartial(); |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - if($highlighted) |
|
| 342 | + if ($highlighted) |
|
| 343 | 343 | { |
| 344 | 344 | $formatting->replaceWithHTMLHighlighting(); |
| 345 | 345 | } |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | { |
| 360 | 360 | $command = $placeholder->getCommand(); |
| 361 | 361 | |
| 362 | - if($command instanceof Mailcode_Interfaces_Commands_ProtectedContent) |
|
| 362 | + if ($command instanceof Mailcode_Interfaces_Commands_ProtectedContent) |
|
| 363 | 363 | { |
| 364 | 364 | $string = $command->restoreContent($string); |
| 365 | 365 | } |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | */ |
| 453 | 453 | public function getCollection() : Mailcode_Collection |
| 454 | 454 | { |
| 455 | - if(isset($this->collection)) |
|
| 455 | + if (isset($this->collection)) |
|
| 456 | 456 | { |
| 457 | 457 | return $this->collection; |
| 458 | 458 | } |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | */ |
| 475 | 475 | protected function requireValidCollection() : void |
| 476 | 476 | { |
| 477 | - if($this->getCollection()->isValid()) |
|
| 477 | + if ($this->getCollection()->isValid()) |
|
| 478 | 478 | { |
| 479 | 479 | return; |
| 480 | 480 | } |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | */ |
| 498 | 498 | public function getPlaceholderStrings() : array |
| 499 | 499 | { |
| 500 | - if(is_array($this->placeholderStrings)) |
|
| 500 | + if (is_array($this->placeholderStrings)) |
|
| 501 | 501 | { |
| 502 | 502 | return $this->placeholderStrings; |
| 503 | 503 | } |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | |
| 507 | 507 | $this->placeholderStrings = array(); |
| 508 | 508 | |
| 509 | - foreach($placeholders as $placeholder) |
|
| 509 | + foreach ($placeholders as $placeholder) |
|
| 510 | 510 | { |
| 511 | 511 | $this->placeholderStrings[] = $placeholder->getReplacementText(); |
| 512 | 512 | } |
@@ -532,9 +532,9 @@ discard block |
||
| 532 | 532 | { |
| 533 | 533 | $placeholders = $this->getPlaceholders(); |
| 534 | 534 | |
| 535 | - foreach($placeholders as $placeholder) |
|
| 535 | + foreach ($placeholders as $placeholder) |
|
| 536 | 536 | { |
| 537 | - if($placeholder->getID() === $id) |
|
| 537 | + if ($placeholder->getID() === $id) |
|
| 538 | 538 | { |
| 539 | 539 | return $placeholder; |
| 540 | 540 | } |
@@ -561,9 +561,9 @@ discard block |
||
| 561 | 561 | { |
| 562 | 562 | $placeholders = $this->getPlaceholders(); |
| 563 | 563 | |
| 564 | - foreach($placeholders as $placeholder) |
|
| 564 | + foreach ($placeholders as $placeholder) |
|
| 565 | 565 | { |
| 566 | - if($placeholder->getReplacementText() === $string) |
|
| 566 | + if ($placeholder->getReplacementText() === $string) |
|
| 567 | 567 | { |
| 568 | 568 | return $placeholder; |
| 569 | 569 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | protected $parent = null; |
| 116 | 116 | |
| 117 | - public function __construct(string $type='', string $paramsString='', string $matchedText='') |
|
| 117 | + public function __construct(string $type = '', string $paramsString = '', string $matchedText = '') |
|
| 118 | 118 | { |
| 119 | 119 | $this->type = $type; |
| 120 | 120 | $this->paramsString = html_entity_decode($paramsString); |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | { |
| 211 | 211 | $this->requireNonDummy(); |
| 212 | 212 | |
| 213 | - if($this->hash === '') { |
|
| 213 | + if ($this->hash === '') { |
|
| 214 | 214 | $this->hash = md5($this->matchedText); |
| 215 | 215 | } |
| 216 | 216 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | protected function requireNonDummy() : void |
| 221 | 221 | { |
| 222 | - if(!$this->isDummy()) |
|
| 222 | + if (!$this->isDummy()) |
|
| 223 | 223 | { |
| 224 | 224 | return; |
| 225 | 225 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | protected function validate() : OperationResult |
| 240 | 240 | { |
| 241 | - if(!$this->validated) |
|
| 241 | + if (!$this->validated) |
|
| 242 | 242 | { |
| 243 | 243 | $this->requireNonDummy(); |
| 244 | 244 | $this->validateSyntax(); |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | public function getValidationResult() : OperationResult |
| 253 | 253 | { |
| 254 | - if(isset($this->validationResult)) |
|
| 254 | + if (isset($this->validationResult)) |
|
| 255 | 255 | { |
| 256 | 256 | return $this->validationResult; |
| 257 | 257 | } |
@@ -267,10 +267,10 @@ discard block |
||
| 267 | 267 | { |
| 268 | 268 | $validations = $this->resolveValidations(); |
| 269 | 269 | |
| 270 | - foreach($validations as $validation) |
|
| 270 | + foreach ($validations as $validation) |
|
| 271 | 271 | { |
| 272 | 272 | // break off at the first validation issue |
| 273 | - if(!$this->validateSyntaxMethod($validation)) |
|
| 273 | + if (!$this->validateSyntaxMethod($validation)) |
|
| 274 | 274 | { |
| 275 | 275 | return; |
| 276 | 276 | } |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | { |
| 290 | 290 | $method = 'validateSyntax_'.$validation; |
| 291 | 291 | |
| 292 | - if(!method_exists($this, $method)) |
|
| 292 | + if (!method_exists($this, $method)) |
|
| 293 | 293 | { |
| 294 | 294 | throw new Mailcode_Exception( |
| 295 | 295 | 'Missing validation method ['.$validation.']', |
@@ -314,12 +314,12 @@ discard block |
||
| 314 | 314 | |
| 315 | 315 | protected function validateSyntax_params_empty() : void |
| 316 | 316 | { |
| 317 | - if(!$this->requiresParameters()) |
|
| 317 | + if (!$this->requiresParameters()) |
|
| 318 | 318 | { |
| 319 | 319 | return; |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | - if(empty($this->paramsString)) |
|
| 322 | + if (empty($this->paramsString)) |
|
| 323 | 323 | { |
| 324 | 324 | $this->validationResult->makeError( |
| 325 | 325 | t('Parameters have to be specified.'), |
@@ -331,14 +331,14 @@ discard block |
||
| 331 | 331 | |
| 332 | 332 | protected function validateSyntax_params_keywords() : void |
| 333 | 333 | { |
| 334 | - if(!$this->supportsLogicKeywords()) |
|
| 334 | + if (!$this->supportsLogicKeywords()) |
|
| 335 | 335 | { |
| 336 | 336 | return; |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | $this->logicKeywords = new Mailcode_Commands_LogicKeywords($this, $this->paramsString); |
| 340 | 340 | |
| 341 | - if(!$this->logicKeywords->isValid()) |
|
| 341 | + if (!$this->logicKeywords->isValid()) |
|
| 342 | 342 | { |
| 343 | 343 | $this->validationResult->makeError( |
| 344 | 344 | t('Invalid parameters:').' '.$this->logicKeywords->getErrorMessage(), |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | |
| 354 | 354 | protected function validateSyntax_params_parse() : void |
| 355 | 355 | { |
| 356 | - if(!$this->requiresParameters()) |
|
| 356 | + if (!$this->requiresParameters()) |
|
| 357 | 357 | { |
| 358 | 358 | return; |
| 359 | 359 | } |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | $this->hasFreeformParameters() |
| 364 | 364 | ); |
| 365 | 365 | |
| 366 | - if(!$this->params->isValid()) |
|
| 366 | + if (!$this->params->isValid()) |
|
| 367 | 367 | { |
| 368 | 368 | $error = $this->params->getValidationResult(); |
| 369 | 369 | |
@@ -385,14 +385,14 @@ discard block |
||
| 385 | 385 | |
| 386 | 386 | protected function validateSyntax_type_supported() : void |
| 387 | 387 | { |
| 388 | - if(!$this->supportsType() || empty($this->type)) |
|
| 388 | + if (!$this->supportsType() || empty($this->type)) |
|
| 389 | 389 | { |
| 390 | 390 | return; |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | $types = $this->getSupportedTypes(); |
| 394 | 394 | |
| 395 | - if(!in_array($this->type, $types)) |
|
| 395 | + if (!in_array($this->type, $types)) |
|
| 396 | 396 | { |
| 397 | 397 | $this->validationResult->makeError( |
| 398 | 398 | t('The command addon %1$s is not supported.', $this->type).' '. |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | |
| 407 | 407 | protected function validateSyntax_type_unsupported() : void |
| 408 | 408 | { |
| 409 | - if($this->supportsType() || empty($this->type)) |
|
| 409 | + if ($this->supportsType() || empty($this->type)) |
|
| 410 | 410 | { |
| 411 | 411 | return; |
| 412 | 412 | } |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | |
| 425 | 425 | public function getType() : string |
| 426 | 426 | { |
| 427 | - if($this->supportsType()) |
|
| 427 | + if ($this->supportsType()) |
|
| 428 | 428 | { |
| 429 | 429 | return $this->type; |
| 430 | 430 | } |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | |
| 445 | 445 | public function getHighlighted() : string |
| 446 | 446 | { |
| 447 | - if(!$this->isValid()) |
|
| 447 | + if (!$this->isValid()) |
|
| 448 | 448 | { |
| 449 | 449 | return ''; |
| 450 | 450 | } |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | |
| 456 | 456 | public function getParamsString() : string |
| 457 | 457 | { |
| 458 | - if($this->requiresParameters()) |
|
| 458 | + if ($this->requiresParameters()) |
|
| 459 | 459 | { |
| 460 | 460 | return $this->paramsString; |
| 461 | 461 | } |
@@ -492,22 +492,22 @@ discard block |
||
| 492 | 492 | |
| 493 | 493 | public final function getCommandType() : string |
| 494 | 494 | { |
| 495 | - if($this instanceof Mailcode_Commands_Command_Type_Closing) |
|
| 495 | + if ($this instanceof Mailcode_Commands_Command_Type_Closing) |
|
| 496 | 496 | { |
| 497 | 497 | return 'Closing'; |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | - if($this instanceof Mailcode_Commands_Command_Type_Opening) |
|
| 500 | + if ($this instanceof Mailcode_Commands_Command_Type_Opening) |
|
| 501 | 501 | { |
| 502 | 502 | return 'Opening'; |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | - if($this instanceof Mailcode_Commands_Command_Type_Sibling) |
|
| 505 | + if ($this instanceof Mailcode_Commands_Command_Type_Sibling) |
|
| 506 | 506 | { |
| 507 | 507 | return 'Sibling'; |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | - if($this instanceof Mailcode_Commands_Command_Type_Standalone) |
|
| 510 | + if ($this instanceof Mailcode_Commands_Command_Type_Standalone) |
|
| 511 | 511 | { |
| 512 | 512 | return 'Standalone'; |
| 513 | 513 | } |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | |
| 558 | 558 | public function getLogicKeywords() : Mailcode_Commands_LogicKeywords |
| 559 | 559 | { |
| 560 | - if($this->supportsLogicKeywords() && isset($this->logicKeywords)) |
|
| 560 | + if ($this->supportsLogicKeywords() && isset($this->logicKeywords)) |
|
| 561 | 561 | { |
| 562 | 562 | return $this->logicKeywords; |
| 563 | 563 | } |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | */ |
| 592 | 592 | public function getTranslationParam(string $name) |
| 593 | 593 | { |
| 594 | - if(isset($this->translationParams[$name])) |
|
| 594 | + if (isset($this->translationParams[$name])) |
|
| 595 | 595 | { |
| 596 | 596 | return $this->translationParams[$name]; |
| 597 | 597 | } |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | * @param bool $encoding |
| 604 | 604 | * @return $this |
| 605 | 605 | */ |
| 606 | - public function setURLEncoding(bool $encoding=true) |
|
| 606 | + public function setURLEncoding(bool $encoding = true) |
|
| 607 | 607 | { |
| 608 | 608 | $this->requireURLEncoding(); |
| 609 | 609 | |
@@ -619,7 +619,7 @@ discard block |
||
| 619 | 619 | * @return $this |
| 620 | 620 | * @throws Mailcode_Exception |
| 621 | 621 | */ |
| 622 | - public function setURLDecoding(bool $decode=true) |
|
| 622 | + public function setURLDecoding(bool $decode = true) |
|
| 623 | 623 | { |
| 624 | 624 | $this->requireURLEncoding(); |
| 625 | 625 | |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | |
| 631 | 631 | protected function requireURLEncoding() : void |
| 632 | 632 | { |
| 633 | - if($this->supportsURLEncoding()) { |
|
| 633 | + if ($this->supportsURLEncoding()) { |
|
| 634 | 634 | return; |
| 635 | 635 | } |
| 636 | 636 | |