@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | public function add(Mailcode_Variables_Variable $variable) : Mailcode_Variables_Collection |
| 28 | 28 | { |
| 29 | - if($variable->isValid()) |
|
| 29 | + if ($variable->isValid()) |
|
| 30 | 30 | { |
| 31 | 31 | return $this; |
| 32 | 32 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | { |
| 39 | 39 | $first = $this->getFirst(); |
| 40 | 40 | |
| 41 | - if($first) |
|
| 41 | + if ($first) |
|
| 42 | 42 | { |
| 43 | 43 | return $first->getValidationResult(); |
| 44 | 44 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | private ?Mailcode_Commands_Command $command; |
| 74 | 74 | |
| 75 | - public function __construct(string $path, string $name, string $matchedText, ?Mailcode_Commands_Command $sourceCommand=null) |
|
| 75 | + public function __construct(string $path, string $name, string $matchedText, ?Mailcode_Commands_Command $sourceCommand = null) |
|
| 76 | 76 | { |
| 77 | 77 | $this->path = $path; |
| 78 | 78 | $this->name = $name; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | public function getFullName() : string |
| 97 | 97 | { |
| 98 | - if(empty($this->path)) |
|
| 98 | + if (empty($this->path)) |
|
| 99 | 99 | { |
| 100 | 100 | return '$'.$this->name; |
| 101 | 101 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function getUniqueName() : string |
| 115 | 115 | { |
| 116 | - if(isset($this->command)) |
|
| 116 | + if (isset($this->command)) |
|
| 117 | 117 | { |
| 118 | 118 | return $this->getFullName().'/'.$this->command->getHash(); |
| 119 | 119 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | public function getHash() : string |
| 140 | 140 | { |
| 141 | - if(empty($this->hash)) |
|
| 141 | + if (empty($this->hash)) |
|
| 142 | 142 | { |
| 143 | 143 | $this->hash = md5($this->matchedText); |
| 144 | 144 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public function getValidationResult() : OperationResult |
| 159 | 159 | { |
| 160 | - if(isset($this->validationResult)) |
|
| 160 | + if (isset($this->validationResult)) |
|
| 161 | 161 | { |
| 162 | 162 | return $this->validationResult; |
| 163 | 163 | } |
@@ -171,11 +171,11 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | protected function validate(OperationResult $result) : void |
| 173 | 173 | { |
| 174 | - foreach($this->validations as $validation) |
|
| 174 | + foreach ($this->validations as $validation) |
|
| 175 | 175 | { |
| 176 | 176 | $method = 'validate_'.$validation; |
| 177 | 177 | |
| 178 | - if(!method_exists($this, $method)) |
|
| 178 | + if (!method_exists($this, $method)) |
|
| 179 | 179 | { |
| 180 | 180 | throw new Mailcode_Exception( |
| 181 | 181 | 'Unknown validation method', |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | protected function validateNumber(string $value, int $errorCode) : void |
| 222 | 222 | { |
| 223 | - if(!is_numeric(substr($value, 0, 1))) |
|
| 223 | + if (!is_numeric(substr($value, 0, 1))) |
|
| 224 | 224 | { |
| 225 | 225 | return; |
| 226 | 226 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | protected function validateUnderscore(string $value, int $errorCode) : void |
| 239 | 239 | { |
| 240 | 240 | // allow empty paths |
| 241 | - if(empty($value)) |
|
| 241 | + if (empty($value)) |
|
| 242 | 242 | { |
| 243 | 243 | return; |
| 244 | 244 | } |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | $length = strlen($value); |
| 247 | 247 | |
| 248 | 248 | // trimming underscores does not change the length: no underscores at start or end of string. |
| 249 | - if(strlen(trim($value, '_')) === $length) |
|
| 249 | + if (strlen(trim($value, '_')) === $length) |
|
| 250 | 250 | { |
| 251 | 251 | return; |
| 252 | 252 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public static function getContent(int $id) : string |
| 113 | 113 | { |
| 114 | - if(isset(self::$contents[$id])) |
|
| 114 | + if (isset(self::$contents[$id])) |
|
| 115 | 115 | { |
| 116 | 116 | return self::$contents[$id]; |
| 117 | 117 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public static function clearContent(int $id) : void |
| 136 | 136 | { |
| 137 | - if(isset(self::$contents[$id])) |
|
| 137 | + if (isset(self::$contents[$id])) |
|
| 138 | 138 | { |
| 139 | 139 | unset(self::$contents[$id]); |
| 140 | 140 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | $names = $this->getContentCommandNames(); |
| 157 | 157 | |
| 158 | - foreach($names as $name) |
|
| 158 | + foreach ($names as $name) |
|
| 159 | 159 | { |
| 160 | 160 | $this->collapseContentCommand($name); |
| 161 | 161 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $commands = Mailcode::create()->getCommands()->getContentCommands(); |
| 175 | 175 | $result = array(); |
| 176 | 176 | |
| 177 | - foreach($commands as $command) |
|
| 177 | + foreach ($commands as $command) |
|
| 178 | 178 | { |
| 179 | 179 | $result[] = $command->getName(); |
| 180 | 180 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | { |
| 246 | 246 | $this->commands = $this->detectCommands($name); |
| 247 | 247 | |
| 248 | - foreach($this->commands as $commandDef) |
|
| 248 | + foreach ($this->commands as $commandDef) |
|
| 249 | 249 | { |
| 250 | 250 | $this->processCommand($commandDef); |
| 251 | 251 | } |
@@ -255,9 +255,9 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | private function validateCommandContents() : void |
| 257 | 257 | { |
| 258 | - foreach($this->commands as $command) |
|
| 258 | + foreach ($this->commands as $command) |
|
| 259 | 259 | { |
| 260 | - if(!$command->validateContent($this, $this->collection)) |
|
| 260 | + if (!$command->validateContent($this, $this->collection)) |
|
| 261 | 261 | { |
| 262 | 262 | return; |
| 263 | 263 | } |
@@ -271,14 +271,14 @@ discard block |
||
| 271 | 271 | { |
| 272 | 272 | $openingCommands = $this->detectOpeningCommands($name); |
| 273 | 273 | |
| 274 | - if(empty($openingCommands)) |
|
| 274 | + if (empty($openingCommands)) |
|
| 275 | 275 | { |
| 276 | 276 | return array(); |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | $closingCommands = $this->detectClosingCommands($name); |
| 280 | 280 | |
| 281 | - if(count($closingCommands) !== count($openingCommands)) |
|
| 281 | + if (count($closingCommands) !== count($openingCommands)) |
|
| 282 | 282 | { |
| 283 | 283 | $this->addClosingError($name); |
| 284 | 284 | return array(); |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | |
| 287 | 287 | $result = array(); |
| 288 | 288 | |
| 289 | - foreach($openingCommands as $idx => $def) |
|
| 289 | + foreach ($openingCommands as $idx => $def) |
|
| 290 | 290 | { |
| 291 | 291 | $result[] = new Mailcode_PreParser_CommandDef( |
| 292 | 292 | $name, |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | */ |
| 329 | 329 | private function debugOpeningCommands(array $matches) : void |
| 330 | 330 | { |
| 331 | - if($this->debug === false) |
|
| 331 | + if ($this->debug === false) |
|
| 332 | 332 | { |
| 333 | 333 | return; |
| 334 | 334 | } |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | |
| 383 | 383 | private function debugCommandDef(Mailcode_PreParser_CommandDef $commandDef) : void |
| 384 | 384 | { |
| 385 | - if($this->debug === true) |
|
| 385 | + if ($this->debug === true) |
|
| 386 | 386 | { |
| 387 | 387 | echo 'Command definition:'.PHP_EOL; |
| 388 | 388 | print_r($commandDef->toArray()); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | private ?Mailcode_Commands_Command $sourceCommand = null; |
| 58 | 58 | |
| 59 | - public function __construct(string $statement, bool $freeform=false, ?Mailcode_Commands_Command $sourceCommand=null) |
|
| 59 | + public function __construct(string $statement, bool $freeform = false, ?Mailcode_Commands_Command $sourceCommand = null) |
|
| 60 | 60 | { |
| 61 | 61 | $this->sourceCommand = $sourceCommand; |
| 62 | 62 | $this->statement = $this->prepareStatement($statement); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | public function getInfo() : Mailcode_Parser_Statement_Info |
| 108 | 108 | { |
| 109 | - if($this->info instanceof Mailcode_Parser_Statement_Info) |
|
| 109 | + if ($this->info instanceof Mailcode_Parser_Statement_Info) |
|
| 110 | 110 | { |
| 111 | 111 | return $this->info; |
| 112 | 112 | } |
@@ -118,12 +118,12 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | protected function validate() : void |
| 120 | 120 | { |
| 121 | - if($this->freeform) |
|
| 121 | + if ($this->freeform) |
|
| 122 | 122 | { |
| 123 | 123 | return; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - if(!$this->tokenizer->hasTokens()) |
|
| 126 | + if (!$this->tokenizer->hasTokens()) |
|
| 127 | 127 | { |
| 128 | 128 | $this->result->makeError( |
| 129 | 129 | t('Empty statement'), |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | $unknown = $this->tokenizer->getFirstUnknown(); |
| 137 | 137 | |
| 138 | - if($unknown) |
|
| 138 | + if ($unknown) |
|
| 139 | 139 | { |
| 140 | 140 | $this->result->makeError( |
| 141 | 141 | t('Unquoted string literal found:').' ('.htmlspecialchars($unknown->getMatchedText()).')', |
@@ -139,11 +139,11 @@ |
||
| 139 | 139 | $commands = $parser->getCommands(); |
| 140 | 140 | $content = $this->getContent(); |
| 141 | 141 | |
| 142 | - foreach($commands as $command) |
|
| 142 | + foreach ($commands as $command) |
|
| 143 | 143 | { |
| 144 | 144 | $string = $command->getOpeningText(); |
| 145 | 145 | |
| 146 | - if(strpos($content, $string) !== false) |
|
| 146 | + if (strpos($content, $string) !== false) |
|
| 147 | 147 | { |
| 148 | 148 | $this->addEscapeError($command, $collection); |
| 149 | 149 | return false; |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $placeholders = $this->getPlaceholdersCollection()->getAll(); |
| 175 | 175 | $string = $this->originalString; |
| 176 | 176 | |
| 177 | - foreach($placeholders as $placeholder) |
|
| 177 | + foreach ($placeholders as $placeholder) |
|
| 178 | 178 | { |
| 179 | 179 | $string = $this->makePlaceholderSafe($string, $placeholder); |
| 180 | 180 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | { |
| 189 | 189 | $pos = mb_strpos($string, $placeholder->getOriginalText()); |
| 190 | 190 | |
| 191 | - if($pos === false) |
|
| 191 | + if ($pos === false) |
|
| 192 | 192 | { |
| 193 | 193 | throw new Mailcode_Exception( |
| 194 | 194 | 'Placeholder original text not found', |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | */ |
| 228 | 228 | public function createFormatting($subject) : Mailcode_Parser_Safeguard_Formatting |
| 229 | 229 | { |
| 230 | - if(is_string($subject)) |
|
| 230 | + if (is_string($subject)) |
|
| 231 | 231 | { |
| 232 | 232 | $subject = Mailcode::create()->createString($subject); |
| 233 | 233 | } |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | public function getPlaceholdersCollection() : Mailcode_Parser_Safeguard_PlaceholderCollection |
| 258 | 258 | { |
| 259 | - if(isset($this->placeholders)) |
|
| 259 | + if (isset($this->placeholders)) |
|
| 260 | 260 | { |
| 261 | 261 | return $this->placeholders; |
| 262 | 262 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | $placeholders = array(); |
| 265 | 265 | $commands = $this->getCollection()->getCommands(); |
| 266 | 266 | |
| 267 | - foreach($commands as $command) |
|
| 267 | + foreach ($commands as $command) |
|
| 268 | 268 | { |
| 269 | 269 | self::$counter++; |
| 270 | 270 | |
@@ -287,21 +287,21 @@ discard block |
||
| 287 | 287 | * @return string |
| 288 | 288 | * @throws Mailcode_Exception |
| 289 | 289 | */ |
| 290 | - protected function restore(string $string, bool $partial=false, bool $highlighted=false) : string |
|
| 290 | + protected function restore(string $string, bool $partial = false, bool $highlighted = false) : string |
|
| 291 | 291 | { |
| 292 | - if(!$partial) |
|
| 292 | + if (!$partial) |
|
| 293 | 293 | { |
| 294 | 294 | $this->requireValidCollection(); |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | $formatting = $this->createFormatting($string); |
| 298 | 298 | |
| 299 | - if($partial) |
|
| 299 | + if ($partial) |
|
| 300 | 300 | { |
| 301 | 301 | $formatting->makePartial(); |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | - if($highlighted) |
|
| 304 | + if ($highlighted) |
|
| 305 | 305 | { |
| 306 | 306 | $formatting->replaceWithHTMLHighlighting(); |
| 307 | 307 | } |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | */ |
| 398 | 398 | public function getCollection() : Mailcode_Collection |
| 399 | 399 | { |
| 400 | - if(isset($this->collection)) |
|
| 400 | + if (isset($this->collection)) |
|
| 401 | 401 | { |
| 402 | 402 | return $this->collection; |
| 403 | 403 | } |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | */ |
| 426 | 426 | protected function requireValidCollection() : void |
| 427 | 427 | { |
| 428 | - if($this->getCollection()->isValid()) |
|
| 428 | + if ($this->getCollection()->isValid()) |
|
| 429 | 429 | { |
| 430 | 430 | return; |
| 431 | 431 | } |
@@ -56,23 +56,23 @@ |
||
| 56 | 56 | |
| 57 | 57 | private function analyzeURL(string $url) : void |
| 58 | 58 | { |
| 59 | - if(stristr($url, 'tel:') !== false) |
|
| 59 | + if (stristr($url, 'tel:') !== false) |
|
| 60 | 60 | { |
| 61 | 61 | return; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | $placeholders = $this->safeguard->getPlaceholdersCollection()->getAll(); |
| 65 | 65 | |
| 66 | - foreach($placeholders as $placeholder) |
|
| 66 | + foreach ($placeholders as $placeholder) |
|
| 67 | 67 | { |
| 68 | 68 | $command = $placeholder->getCommand(); |
| 69 | 69 | |
| 70 | - if(!$command->supportsURLEncoding()) |
|
| 70 | + if (!$command->supportsURLEncoding()) |
|
| 71 | 71 | { |
| 72 | 72 | continue; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - if(strstr($url, $placeholder->getReplacementText()) !== false && !$command->isURLDecoded()) |
|
| 75 | + if (strstr($url, $placeholder->getReplacementText()) !== false && !$command->isURLDecoded()) |
|
| 76 | 76 | { |
| 77 | 77 | $command->setURLEncoding(true); |
| 78 | 78 | break; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function getByIndex(int $index) : Mailcode_Parser_Safeguard_Placeholder |
| 41 | 41 | { |
| 42 | - if(isset($this->placeholders[$index])) |
|
| 42 | + if (isset($this->placeholders[$index])) |
|
| 43 | 43 | { |
| 44 | 44 | return $this->placeholders[$index]; |
| 45 | 45 | } |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | public function getByCommand(Mailcode_Commands_Command $command) : Mailcode_Parser_Safeguard_Placeholder |
| 55 | 55 | { |
| 56 | - foreach($this->placeholders as $placeholder) |
|
| 56 | + foreach ($this->placeholders as $placeholder) |
|
| 57 | 57 | { |
| 58 | - if($placeholder->getCommand() === $command) |
|
| 58 | + if ($placeholder->getCommand() === $command) |
|
| 59 | 59 | { |
| 60 | 60 | return $placeholder; |
| 61 | 61 | } |
@@ -77,9 +77,9 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public function getByID(int $id) : Mailcode_Parser_Safeguard_Placeholder |
| 79 | 79 | { |
| 80 | - foreach($this->placeholders as $placeholder) |
|
| 80 | + foreach ($this->placeholders as $placeholder) |
|
| 81 | 81 | { |
| 82 | - if($placeholder->getID() === $id) |
|
| 82 | + if ($placeholder->getID() === $id) |
|
| 83 | 83 | { |
| 84 | 84 | return $placeholder; |
| 85 | 85 | } |
@@ -104,9 +104,9 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function getByString(string $string) : Mailcode_Parser_Safeguard_Placeholder |
| 106 | 106 | { |
| 107 | - foreach($this->placeholders as $placeholder) |
|
| 107 | + foreach ($this->placeholders as $placeholder) |
|
| 108 | 108 | { |
| 109 | - if($placeholder->getReplacementText() === $string) |
|
| 109 | + if ($placeholder->getReplacementText() === $string) |
|
| 110 | 110 | { |
| 111 | 111 | return $placeholder; |
| 112 | 112 | } |
@@ -129,14 +129,14 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function getStrings() : array |
| 131 | 131 | { |
| 132 | - if(is_array($this->placeholderStrings)) |
|
| 132 | + if (is_array($this->placeholderStrings)) |
|
| 133 | 133 | { |
| 134 | 134 | return $this->placeholderStrings; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | $this->placeholderStrings = array(); |
| 138 | 138 | |
| 139 | - foreach($this->placeholders as $placeholder) |
|
| 139 | + foreach ($this->placeholders as $placeholder) |
|
| 140 | 140 | { |
| 141 | 141 | $this->placeholderStrings[] = $placeholder->getReplacementText(); |
| 142 | 142 | } |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | { |
| 114 | 114 | $result = array(); |
| 115 | 115 | |
| 116 | - foreach($this->tokensOrdered as $token) |
|
| 116 | + foreach ($this->tokensOrdered as $token) |
|
| 117 | 117 | { |
| 118 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Unknown) |
|
| 118 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Unknown) |
|
| 119 | 119 | { |
| 120 | 120 | $result[] = $token; |
| 121 | 121 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | { |
| 129 | 129 | $unknown = $this->getUnknown(); |
| 130 | 130 | |
| 131 | - if(!empty($unknown)) |
|
| 131 | + if (!empty($unknown)) |
|
| 132 | 132 | { |
| 133 | 133 | return array_shift($unknown); |
| 134 | 134 | } |
@@ -140,11 +140,11 @@ discard block |
||
| 140 | 140 | { |
| 141 | 141 | $parts = array(); |
| 142 | 142 | |
| 143 | - foreach($this->tokensOrdered as $token) |
|
| 143 | + foreach ($this->tokensOrdered as $token) |
|
| 144 | 144 | { |
| 145 | 145 | $string = $token->getNormalized(); |
| 146 | 146 | |
| 147 | - if($string !== '') |
|
| 147 | + if ($string !== '') |
|
| 148 | 148 | { |
| 149 | 149 | $parts[] = $string; |
| 150 | 150 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $statement = trim($statement); |
| 169 | 169 | $tokens = array(); |
| 170 | 170 | |
| 171 | - foreach($this->tokenCategories as $tokenCategory) |
|
| 171 | + foreach ($this->tokenCategories as $tokenCategory) |
|
| 172 | 172 | { |
| 173 | 173 | $processor = $this->createProcessor($tokenCategory, $statement, $tokens); |
| 174 | 174 | $processor->process(); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | |
| 195 | 195 | $instance = new $class($this, $statement, $tokens); |
| 196 | 196 | |
| 197 | - if($instance instanceof Mailcode_Parser_Statement_Tokenizer_Process) |
|
| 197 | + if ($instance instanceof Mailcode_Parser_Statement_Tokenizer_Process) |
|
| 198 | 198 | { |
| 199 | 199 | return $instance; |
| 200 | 200 | } |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | * @param mixed $subject |
| 216 | 216 | * @return Mailcode_Parser_Statement_Tokenizer_Token |
| 217 | 217 | */ |
| 218 | - public function createToken(string $type, string $matchedText, $subject=null) : Mailcode_Parser_Statement_Tokenizer_Token |
|
| 218 | + public function createToken(string $type, string $matchedText, $subject = null) : Mailcode_Parser_Statement_Tokenizer_Token |
|
| 219 | 219 | { |
| 220 | 220 | $tokenID = $this->generateID(); |
| 221 | 221 | |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | $token = new $class($tokenID, $matchedText, $subject, $this->getSourceCommand()); |
| 225 | 225 | |
| 226 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token) |
|
| 226 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token) |
|
| 227 | 227 | { |
| 228 | 228 | return $token; |
| 229 | 229 | } |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | $token = $this->appendToken('Keyword', $name); |
| 246 | 246 | |
| 247 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 247 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 248 | 248 | { |
| 249 | 249 | return $token; |
| 250 | 250 | } |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | |
| 264 | 264 | foreach ($this->tokensOrdered as $checkToken) |
| 265 | 265 | { |
| 266 | - if($checkToken->getID() !== $tokenID) |
|
| 266 | + if ($checkToken->getID() !== $tokenID) |
|
| 267 | 267 | { |
| 268 | 268 | $keep[] = $checkToken; |
| 269 | 269 | } |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | * @param mixed $subject |
| 283 | 283 | * @return Mailcode_Parser_Statement_Tokenizer_Token |
| 284 | 284 | */ |
| 285 | - protected function appendToken(string $type, string $matchedText, $subject=null) : Mailcode_Parser_Statement_Tokenizer_Token |
|
| 285 | + protected function appendToken(string $type, string $matchedText, $subject = null) : Mailcode_Parser_Statement_Tokenizer_Token |
|
| 286 | 286 | { |
| 287 | 287 | $token = $this->createToken($type, $matchedText, $subject); |
| 288 | 288 | |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | { |
| 305 | 305 | static $alphas; |
| 306 | 306 | |
| 307 | - if(!isset($alphas)) |
|
| 307 | + if (!isset($alphas)) |
|
| 308 | 308 | { |
| 309 | 309 | $alphas = range('A', 'Z'); |
| 310 | 310 | } |
@@ -313,12 +313,12 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | $result = ''; |
| 315 | 315 | |
| 316 | - for($i=0; $i < $amount; $i++) |
|
| 316 | + for ($i = 0; $i < $amount; $i++) |
|
| 317 | 317 | { |
| 318 | 318 | $result .= $alphas[array_rand($alphas)]; |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - if(!in_array($result, self::$ids)) |
|
| 321 | + if (!in_array($result, self::$ids)) |
|
| 322 | 322 | { |
| 323 | 323 | self::$ids[] = $result; |
| 324 | 324 | return $result; |