@@ -11,7 +11,7 @@ |
||
| 11 | 11 | $matches = array(); |
| 12 | 12 | preg_match_all('/-*[0-9]+\s*[.,]\s*[0-9]+|-*[0-9]+/sx', $this->tokenized, $matches, PREG_PATTERN_ORDER); |
| 13 | 13 | |
| 14 | - foreach($matches[0] as $match) |
|
| 14 | + foreach ($matches[0] as $match) |
|
| 15 | 15 | { |
| 16 | 16 | $this->registerToken('Number', $match); |
| 17 | 17 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | $total = count($matches[0]); |
| 82 | 82 | |
| 83 | - for($i=0; $i < $total; $i++) |
|
| 83 | + for ($i = 0; $i < $total; $i++) |
|
| 84 | 84 | { |
| 85 | 85 | $match = $this->parseMatch($matches, $i); |
| 86 | 86 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | protected function prepareString(string $subject) : string |
| 94 | 94 | { |
| 95 | - if(!ConvertHelper::isStringHTML($subject)) |
|
| 95 | + if (!ConvertHelper::isStringHTML($subject)) |
|
| 96 | 96 | { |
| 97 | 97 | return $subject; |
| 98 | 98 | } |
@@ -142,17 +142,17 @@ discard block |
||
| 142 | 142 | private function handleNesting(Mailcode_Commands_Command $cmd) : void |
| 143 | 143 | { |
| 144 | 144 | // Set the command's parent from the stack, if any is present. |
| 145 | - if(!empty($this->stack)) |
|
| 145 | + if (!empty($this->stack)) |
|
| 146 | 146 | { |
| 147 | 147 | $cmd->setParent($this->getStackLast()); |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | // Handle opening and closing commands, adding and removing from the stack. |
| 151 | - if($cmd instanceof Mailcode_Commands_Command_Type_Opening) |
|
| 151 | + if ($cmd instanceof Mailcode_Commands_Command_Type_Opening) |
|
| 152 | 152 | { |
| 153 | 153 | $this->stack[] = $cmd; |
| 154 | 154 | } |
| 155 | - else if($cmd instanceof Mailcode_Commands_Command_Type_Closing) |
|
| 155 | + else if ($cmd instanceof Mailcode_Commands_Command_Type_Closing) |
|
| 156 | 156 | { |
| 157 | 157 | array_pop($this->stack); |
| 158 | 158 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | { |
| 163 | 163 | $cmd = $this->stack[array_key_last($this->stack)]; |
| 164 | 164 | |
| 165 | - if($cmd instanceof Mailcode_Commands_Command) |
|
| 165 | + if ($cmd instanceof Mailcode_Commands_Command) |
|
| 166 | 166 | { |
| 167 | 167 | return $cmd; |
| 168 | 168 | } |
@@ -191,16 +191,16 @@ discard block |
||
| 191 | 191 | // 5 = parameter type command, type |
| 192 | 192 | // 6 = parameter type command, params |
| 193 | 193 | |
| 194 | - if(!empty($matches[1][$index])) |
|
| 194 | + if (!empty($matches[1][$index])) |
|
| 195 | 195 | { |
| 196 | 196 | $name = $matches[1][$index]; |
| 197 | 197 | } |
| 198 | - else if(!empty($matches[2][$index])) |
|
| 198 | + else if (!empty($matches[2][$index])) |
|
| 199 | 199 | { |
| 200 | 200 | $name = $matches[2][$index]; |
| 201 | 201 | $params = $matches[3][$index]; |
| 202 | 202 | } |
| 203 | - else if(!empty($matches[4][$index])) |
|
| 203 | + else if (!empty($matches[4][$index])) |
|
| 204 | 204 | { |
| 205 | 205 | $name = $matches[4][$index]; |
| 206 | 206 | $type = $matches[5][$index]; |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @param bool $freeform |
| 237 | 237 | * @return Mailcode_Parser_Statement |
| 238 | 238 | */ |
| 239 | - public function createStatement(string $statement, bool $freeform=false) : Mailcode_Parser_Statement |
|
| 239 | + public function createStatement(string $statement, bool $freeform = false) : Mailcode_Parser_Statement |
|
| 240 | 240 | { |
| 241 | 241 | return new Mailcode_Parser_Statement($statement, $freeform); |
| 242 | 242 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | public function protectContent(string $string, Mailcode_Parser_Safeguard_Placeholder $open, Mailcode_Parser_Safeguard_Placeholder $end) : string |
| 35 | 35 | { |
| 36 | - if(!$end->getCommand() instanceof Mailcode_Commands_Command_End) |
|
| 36 | + if (!$end->getCommand() instanceof Mailcode_Commands_Command_End) |
|
| 37 | 37 | { |
| 38 | 38 | throw new Mailcode_Exception( |
| 39 | 39 | 'Invalid commands nesting', |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $start = strpos($string, $open->getReplacementText()) + $open->getReplacementLength(); |
| 46 | 46 | $end = strpos($string, $end->getReplacementText()); |
| 47 | 47 | |
| 48 | - $content = substr($string, $start, ($end-$start)); |
|
| 48 | + $content = substr($string, $start, ($end - $start)); |
|
| 49 | 49 | |
| 50 | 50 | return $this->replaceContent($string, $content); |
| 51 | 51 | } |