@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function getSyntaxName() : string |
| 113 | 113 | { |
| 114 | - if(isset($this->langToken)) |
|
| 114 | + if (isset($this->langToken)) |
|
| 115 | 115 | { |
| 116 | 116 | return $this->langToken->getText(); |
| 117 | 117 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | ->getInfo() |
| 135 | 135 | ->getStringLiteralByIndex(1); |
| 136 | 136 | |
| 137 | - if($lang) |
|
| 137 | + if ($lang) |
|
| 138 | 138 | { |
| 139 | 139 | $this->langToken = $lang; |
| 140 | 140 | return; |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | { |
| 159 | 159 | // To keep PHPStan happy. If no token has been found, this |
| 160 | 160 | // method will not be called. |
| 161 | - if(!isset($this->langToken)) |
|
| 161 | + if (!isset($this->langToken)) |
|
| 162 | 162 | { |
| 163 | 163 | return; |
| 164 | 164 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $name = $this->langToken->getText(); |
| 167 | 167 | $supported = self::getSupportedSyntaxes(); |
| 168 | 168 | |
| 169 | - if(in_array($name, $supported)) |
|
| 169 | + if (in_array($name, $supported)) |
|
| 170 | 170 | { |
| 171 | 171 | return; |
| 172 | 172 | } |
@@ -84,15 +84,15 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | $literals = $this->requireParams()->getInfo()->getStringLiterals(); |
| 86 | 86 | |
| 87 | - if(empty($literals)) { |
|
| 87 | + if (empty($literals)) { |
|
| 88 | 88 | return; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - foreach($literals as $literal) |
|
| 91 | + foreach ($literals as $literal) |
|
| 92 | 92 | { |
| 93 | 93 | $parts = ConvertHelper::explodeTrim(' ', $literal->getText()); |
| 94 | 94 | |
| 95 | - foreach($parts as $part) { |
|
| 95 | + foreach ($parts as $part) { |
|
| 96 | 96 | $this->addClass($part); |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -106,9 +106,9 @@ discard block |
||
| 106 | 106 | { |
| 107 | 107 | $className = trim($className); |
| 108 | 108 | |
| 109 | - if($this->isClassNameValid($className)) |
|
| 109 | + if ($this->isClassNameValid($className)) |
|
| 110 | 110 | { |
| 111 | - if(!in_array($className, $this->classes, true)) { |
|
| 111 | + if (!in_array($className, $this->classes, true)) { |
|
| 112 | 112 | $this->classes[] = $className; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | public function preProcessOpening(): string |
| 142 | 142 | { |
| 143 | - if($this->isMultiline()) { |
|
| 143 | + if ($this->isMultiline()) { |
|
| 144 | 144 | return sprintf('<pre%s>', $this->renderAttributes()); |
| 145 | 145 | } |
| 146 | 146 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | public function preProcessClosing(): string |
| 151 | 151 | { |
| 152 | - if($this->isMultiline()) { |
|
| 152 | + if ($this->isMultiline()) { |
|
| 153 | 153 | return '</pre>'; |
| 154 | 154 | } |
| 155 | 155 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | private function renderAttributes() : string |
| 160 | 160 | { |
| 161 | - if(empty($this->classes)) { |
|
| 161 | + if (empty($this->classes)) { |
|
| 162 | 162 | return ''; |
| 163 | 163 | } |
| 164 | 164 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | $val = $this->validator->createStringLiteral(); |
| 74 | 74 | |
| 75 | - if($val->isValid()) |
|
| 75 | + if ($val->isValid()) |
|
| 76 | 76 | { |
| 77 | 77 | $this->sourceFormat = strtoupper($val->getToken()->getText()); |
| 78 | 78 | return; |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | { |
| 95 | 95 | $countries = self::getSupportedCountries(); |
| 96 | 96 | |
| 97 | - if(isset($countries[$this->sourceFormat])) { |
|
| 97 | + if (isset($countries[$this->sourceFormat])) { |
|
| 98 | 98 | return; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public static function getSupportedCountries() : array |
| 115 | 115 | { |
| 116 | - if(self::$countriesLoaded) { |
|
| 116 | + if (self::$countriesLoaded) { |
|
| 117 | 117 | return self::$supportedCountries; |
| 118 | 118 | } |
| 119 | 119 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | $data = self::loadData(); |
| 123 | 123 | |
| 124 | - foreach($data as $code => $def) |
|
| 124 | + foreach ($data as $code => $def) |
|
| 125 | 125 | { |
| 126 | 126 | $code = (string)$code; |
| 127 | 127 | |
@@ -145,9 +145,9 @@ discard block |
||
| 145 | 145 | $data = FileHelper::parseJSONFile(__DIR__.'/ShowPhone/numbers.json'); |
| 146 | 146 | $result = array(); |
| 147 | 147 | |
| 148 | - foreach($data as $idx => $def) |
|
| 148 | + foreach ($data as $idx => $def) |
|
| 149 | 149 | { |
| 150 | - if(!is_array($def) || !is_string($idx)) |
|
| 150 | + if (!is_array($def) || !is_string($idx)) |
|
| 151 | 151 | { |
| 152 | 152 | continue; |
| 153 | 153 | } |
@@ -71,9 +71,9 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | private function parse() : void |
| 73 | 73 | { |
| 74 | - foreach($this->names as $name) |
|
| 74 | + foreach ($this->names as $name) |
|
| 75 | 75 | { |
| 76 | - if(!stristr($this->paramsString, $name)) |
|
| 76 | + if (!stristr($this->paramsString, $name)) |
|
| 77 | 77 | { |
| 78 | 78 | continue; |
| 79 | 79 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $names = $this->getDetectedNames(); |
| 91 | 91 | $amount = count($names); |
| 92 | 92 | |
| 93 | - if($amount > 1) |
|
| 93 | + if ($amount > 1) |
|
| 94 | 94 | { |
| 95 | 95 | $this->makeError( |
| 96 | 96 | t( |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | private function splitParams() : void |
| 112 | 112 | { |
| 113 | - if(empty($this->keywords)) |
|
| 113 | + if (empty($this->keywords)) |
|
| 114 | 114 | { |
| 115 | 115 | $this->mainParams = $this->paramsString; |
| 116 | 116 | |
@@ -119,13 +119,13 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | $params = $this->detectParameters(); |
| 121 | 121 | |
| 122 | - foreach($this->keywords as $keyword) |
|
| 122 | + foreach ($this->keywords as $keyword) |
|
| 123 | 123 | { |
| 124 | 124 | $kParams = (string)array_shift($params); |
| 125 | 125 | |
| 126 | 126 | $keyword->setParamsString($kParams); |
| 127 | 127 | |
| 128 | - if(!$keyword->isValid()) |
|
| 128 | + if (!$keyword->isValid()) |
|
| 129 | 129 | { |
| 130 | 130 | $this->makeError( |
| 131 | 131 | t('Error #%1$s:', $keyword->getCode()).' '.$keyword->getErrorMessage(), |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $params = $this->paramsString; |
| 146 | 146 | $stack = array(); |
| 147 | 147 | |
| 148 | - foreach($this->keywords as $keyword) |
|
| 148 | + foreach ($this->keywords as $keyword) |
|
| 149 | 149 | { |
| 150 | 150 | $params = $this->detectParamsKeyword($params, $keyword, $stack); |
| 151 | 151 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $search = $keyword->getMatchedString(); |
| 170 | 170 | $pos = strpos($params, $search, 0); |
| 171 | 171 | |
| 172 | - if($pos === false) |
|
| 172 | + if ($pos === false) |
|
| 173 | 173 | { |
| 174 | 174 | throw new Mailcode_Exception( |
| 175 | 175 | 'Keyword matched string not found', |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | $length = strlen($search); |
| 182 | 182 | |
| 183 | 183 | $store = substr($params, 0, $pos); |
| 184 | - $params = trim(substr($params, $pos+$length)); |
|
| 184 | + $params = trim(substr($params, $pos + $length)); |
|
| 185 | 185 | |
| 186 | 186 | $stack[] = $store; |
| 187 | 187 | |
@@ -208,11 +208,11 @@ discard block |
||
| 208 | 208 | { |
| 209 | 209 | $names = array(); |
| 210 | 210 | |
| 211 | - foreach($this->keywords as $keyword) |
|
| 211 | + foreach ($this->keywords as $keyword) |
|
| 212 | 212 | { |
| 213 | 213 | $name = $keyword->getName(); |
| 214 | 214 | |
| 215 | - if(!in_array($name, $names)) |
|
| 215 | + if (!in_array($name, $names)) |
|
| 216 | 216 | { |
| 217 | 217 | $names[] = $name; |
| 218 | 218 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | $matches = array(); |
| 246 | 246 | preg_match_all($regex, $this->paramsString, $matches, PREG_PATTERN_ORDER); |
| 247 | 247 | |
| 248 | - if(!isset($matches[0][0]) || empty($matches[0][0])) |
|
| 248 | + if (!isset($matches[0][0]) || empty($matches[0][0])) |
|
| 249 | 249 | { |
| 250 | 250 | return array(); |
| 251 | 251 | } |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | $amount = count($matches[0]); |
| 254 | 254 | $result = array(); |
| 255 | 255 | |
| 256 | - for($i=0; $i < $amount; $i++) |
|
| 256 | + for ($i = 0; $i < $amount; $i++) |
|
| 257 | 257 | { |
| 258 | 258 | $result[] = $this->createKeyword( |
| 259 | 259 | $name, |
@@ -270,22 +270,22 @@ discard block |
||
| 270 | 270 | return !empty($this->keywords); |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | - public function appendAND(string $paramsString, string $type='') : Mailcode_Commands_LogicKeywords_Keyword |
|
| 273 | + public function appendAND(string $paramsString, string $type = '') : Mailcode_Commands_LogicKeywords_Keyword |
|
| 274 | 274 | { |
| 275 | 275 | return $this->appendKeyword('and', $paramsString, $type); |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - public function appendOR(string $paramsString, string $type='') : Mailcode_Commands_LogicKeywords_Keyword |
|
| 278 | + public function appendOR(string $paramsString, string $type = '') : Mailcode_Commands_LogicKeywords_Keyword |
|
| 279 | 279 | { |
| 280 | 280 | return $this->appendKeyword('or', $paramsString, $type); |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | - public function appendKeyword(string $name, string $paramsString, string $type='') : Mailcode_Commands_LogicKeywords_Keyword |
|
| 283 | + public function appendKeyword(string $name, string $paramsString, string $type = '') : Mailcode_Commands_LogicKeywords_Keyword |
|
| 284 | 284 | { |
| 285 | 285 | $keyword = $this->createKeyword($name, $type); |
| 286 | 286 | $keyword->setParamsString($paramsString); |
| 287 | 287 | |
| 288 | - if(!$keyword->isValid()) |
|
| 288 | + if (!$keyword->isValid()) |
|
| 289 | 289 | { |
| 290 | 290 | throw new Mailcode_Exception( |
| 291 | 291 | 'Cannot append invalid logic keyword', |
@@ -306,13 +306,13 @@ discard block |
||
| 306 | 306 | return $keyword; |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | - private function createKeyword(string $name, string $type='', string $matchedString='') : Mailcode_Commands_LogicKeywords_Keyword |
|
| 309 | + private function createKeyword(string $name, string $type = '', string $matchedString = '') : Mailcode_Commands_LogicKeywords_Keyword |
|
| 310 | 310 | { |
| 311 | - if(empty($matchedString)) |
|
| 311 | + if (empty($matchedString)) |
|
| 312 | 312 | { |
| 313 | 313 | $matchedString = $name; |
| 314 | 314 | |
| 315 | - if(!empty($type)) |
|
| 315 | + if (!empty($type)) |
|
| 316 | 316 | { |
| 317 | 317 | $matchedString .= ' '.$type; |
| 318 | 318 | } |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | { |
| 9 | 9 | public const VALIDATION_NAME_NOHTML = 'nohtml'; |
| 10 | 10 | |
| 11 | - public function setHTMLEnabled(bool $enabled=true) : self; |
|
| 11 | + public function setHTMLEnabled(bool $enabled = true) : self; |
|
| 12 | 12 | |
| 13 | 13 | public function isHTMLEnabled() : bool; |
| 14 | 14 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public function getParser() : Mailcode_Parser |
| 79 | 79 | { |
| 80 | - if(!isset($this->parser)) |
|
| 80 | + if (!isset($this->parser)) |
|
| 81 | 81 | { |
| 82 | 82 | $this->parser = new Mailcode_Parser($this); |
| 83 | 83 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | public function getCommands() : Mailcode_Commands |
| 95 | 95 | { |
| 96 | - if(!isset($this->commands)) |
|
| 96 | + if (!isset($this->commands)) |
|
| 97 | 97 | { |
| 98 | 98 | $this->commands = new Mailcode_Commands(); |
| 99 | 99 | } |
@@ -118,14 +118,14 @@ discard block |
||
| 118 | 118 | * @param Mailcode_Commands_Command|null $sourceCommand |
| 119 | 119 | * @return Mailcode_Variables_Collection_Regular |
| 120 | 120 | */ |
| 121 | - public function findVariables(string $subject, ?Mailcode_Commands_Command $sourceCommand=null) : Mailcode_Variables_Collection_Regular |
|
| 121 | + public function findVariables(string $subject, ?Mailcode_Commands_Command $sourceCommand = null) : Mailcode_Variables_Collection_Regular |
|
| 122 | 122 | { |
| 123 | 123 | return $this->createVariables()->parseString($subject, $sourceCommand); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | public function createVariables() : Mailcode_Variables |
| 127 | 127 | { |
| 128 | - if(!isset($this->variables)) |
|
| 128 | + if (!isset($this->variables)) |
|
| 129 | 129 | { |
| 130 | 130 | $this->variables = new Mailcode_Variables(); |
| 131 | 131 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | public function createTranslator() : Mailcode_Translator |
| 143 | 143 | { |
| 144 | - if(!isset($this->translator)) |
|
| 144 | + if (!isset($this->translator)) |
|
| 145 | 145 | { |
| 146 | 146 | $this->translator = new Mailcode_Translator(); |
| 147 | 147 | } |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | return self::$logger; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - public static function setDebugging(bool $enabled=true) : void |
|
| 192 | + public static function setDebugging(bool $enabled = true) : void |
|
| 193 | 193 | { |
| 194 | 194 | self::$debug = $enabled; |
| 195 | 195 | } |
@@ -204,9 +204,9 @@ discard block |
||
| 204 | 204 | * @param array<string|int,mixed> $context |
| 205 | 205 | * @return void |
| 206 | 206 | */ |
| 207 | - public static function debug(string $message, array $context=array()) : void |
|
| 207 | + public static function debug(string $message, array $context = array()) : void |
|
| 208 | 208 | { |
| 209 | - if(self::$debug && isset(self::$logger)) |
|
| 209 | + if (self::$debug && isset(self::$logger)) |
|
| 210 | 210 | { |
| 211 | 211 | self::$logger->debug($message, $context); |
| 212 | 212 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | { |
| 49 | 49 | $instanceID = $command->getInstanceID(); |
| 50 | 50 | |
| 51 | - if(isset(self::$generated[$instanceID])) |
|
| 51 | + if (isset(self::$generated[$instanceID])) |
|
| 52 | 52 | { |
| 53 | 53 | return self::$generated[$instanceID]; |
| 54 | 54 | } |
@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | private static function generateIDString(TrackingIDInterface $command) : string |
| 87 | 87 | { |
| 88 | - if(isset(self::$customGenerator)) |
|
| 88 | + if (isset(self::$customGenerator)) |
|
| 89 | 89 | { |
| 90 | 90 | $result = call_user_func(self::$customGenerator, $command); |
| 91 | 91 | |
| 92 | - if(is_string($result)) |
|
| 92 | + if (is_string($result)) |
|
| 93 | 93 | { |
| 94 | 94 | return $result; |
| 95 | 95 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | $result = new ParseResult($collection, $preParser); |
| 74 | 74 | |
| 75 | - if(!$collection->isValid()) |
|
| 75 | + if (!$collection->isValid()) |
|
| 76 | 76 | { |
| 77 | 77 | return $result; |
| 78 | 78 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | $total = count($matches[0]); |
| 86 | 86 | |
| 87 | - for($i=0; $i < $total; $i++) |
|
| 87 | + for ($i = 0; $i < $total; $i++) |
|
| 88 | 88 | { |
| 89 | 89 | $match = $this->parseMatch($matches, $i); |
| 90 | 90 | |
@@ -154,17 +154,17 @@ discard block |
||
| 154 | 154 | private function handleNesting(Mailcode_Commands_Command $cmd) : void |
| 155 | 155 | { |
| 156 | 156 | // Set the command's parent from the stack, if any is present. |
| 157 | - if(!empty($this->stack)) |
|
| 157 | + if (!empty($this->stack)) |
|
| 158 | 158 | { |
| 159 | 159 | $cmd->setParent($this->getStackLast()); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | // Handle opening and closing commands, adding and removing from the stack. |
| 163 | - if($cmd instanceof Mailcode_Commands_Command_Type_Opening) |
|
| 163 | + if ($cmd instanceof Mailcode_Commands_Command_Type_Opening) |
|
| 164 | 164 | { |
| 165 | 165 | $this->stack[] = $cmd; |
| 166 | 166 | } |
| 167 | - else if($cmd instanceof Mailcode_Commands_Command_Type_Closing) |
|
| 167 | + else if ($cmd instanceof Mailcode_Commands_Command_Type_Closing) |
|
| 168 | 168 | { |
| 169 | 169 | array_pop($this->stack); |
| 170 | 170 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | { |
| 179 | 179 | $cmd = $this->stack[array_key_last($this->stack)]; |
| 180 | 180 | |
| 181 | - if($cmd instanceof Mailcode_Commands_Command) |
|
| 181 | + if ($cmd instanceof Mailcode_Commands_Command) |
|
| 182 | 182 | { |
| 183 | 183 | return $cmd; |
| 184 | 184 | } |
@@ -207,16 +207,16 @@ discard block |
||
| 207 | 207 | // 5 = parameter type command, type |
| 208 | 208 | // 6 = parameter type command, params |
| 209 | 209 | |
| 210 | - if(!empty($matches[1][$index])) |
|
| 210 | + if (!empty($matches[1][$index])) |
|
| 211 | 211 | { |
| 212 | 212 | $name = $matches[1][$index]; |
| 213 | 213 | } |
| 214 | - else if(!empty($matches[2][$index])) |
|
| 214 | + else if (!empty($matches[2][$index])) |
|
| 215 | 215 | { |
| 216 | 216 | $name = $matches[2][$index]; |
| 217 | 217 | $params = $matches[3][$index]; |
| 218 | 218 | } |
| 219 | - else if(!empty($matches[4][$index])) |
|
| 219 | + else if (!empty($matches[4][$index])) |
|
| 220 | 220 | { |
| 221 | 221 | $name = $matches[4][$index]; |
| 222 | 222 | $type = $matches[5][$index]; |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | * @param Mailcode_Commands_Command|null $sourceCommand |
| 254 | 254 | * @return Mailcode_Parser_Statement |
| 255 | 255 | */ |
| 256 | - public function createStatement(string $statement, bool $freeform=false, ?Mailcode_Commands_Command $sourceCommand=null) : Mailcode_Parser_Statement |
|
| 256 | + public function createStatement(string $statement, bool $freeform = false, ?Mailcode_Commands_Command $sourceCommand = null) : Mailcode_Parser_Statement |
|
| 257 | 257 | { |
| 258 | 258 | return new Mailcode_Parser_Statement($statement, $freeform, $sourceCommand); |
| 259 | 259 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public static function getContent(int $id) : string |
| 118 | 118 | { |
| 119 | - if(isset(self::$contents[$id])) |
|
| 119 | + if (isset(self::$contents[$id])) |
|
| 120 | 120 | { |
| 121 | 121 | return self::$contents[$id]; |
| 122 | 122 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public static function clearContent(int $id) : void |
| 141 | 141 | { |
| 142 | - if(isset(self::$contents[$id])) |
|
| 142 | + if (isset(self::$contents[$id])) |
|
| 143 | 143 | { |
| 144 | 144 | unset(self::$contents[$id]); |
| 145 | 145 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | public function parse() : self |
| 158 | 158 | { |
| 159 | - if($this->parsed) |
|
| 159 | + if ($this->parsed) |
|
| 160 | 160 | { |
| 161 | 161 | return $this; |
| 162 | 162 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | $this->detectCommands(); |
| 168 | 168 | |
| 169 | - foreach($this->commands as $commandDef) |
|
| 169 | + foreach ($this->commands as $commandDef) |
|
| 170 | 170 | { |
| 171 | 171 | $this->processCommand($commandDef); |
| 172 | 172 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $commands = Mailcode::create()->getCommands()->getContentCommands(); |
| 188 | 188 | $result = array(); |
| 189 | 189 | |
| 190 | - foreach($commands as $command) |
|
| 190 | + foreach ($commands as $command) |
|
| 191 | 191 | { |
| 192 | 192 | $result[] = $command->getName(); |
| 193 | 193 | } |
@@ -260,9 +260,9 @@ discard block |
||
| 260 | 260 | |
| 261 | 261 | private function validateCommandContents() : void |
| 262 | 262 | { |
| 263 | - foreach($this->commands as $command) |
|
| 263 | + foreach ($this->commands as $command) |
|
| 264 | 264 | { |
| 265 | - if(!$command->validateContent($this, $this->collection)) |
|
| 265 | + if (!$command->validateContent($this, $this->collection)) |
|
| 266 | 266 | { |
| 267 | 267 | return; |
| 268 | 268 | } |
@@ -274,12 +274,12 @@ discard block |
||
| 274 | 274 | $openingCommands = $this->detectOpeningCommands(); |
| 275 | 275 | $closingCommands = $this->detectClosingCommands(); |
| 276 | 276 | |
| 277 | - if(!$this->validateCommandsList($openingCommands, $closingCommands)) |
|
| 277 | + if (!$this->validateCommandsList($openingCommands, $closingCommands)) |
|
| 278 | 278 | { |
| 279 | 279 | return; |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - foreach($openingCommands as $idx => $def) |
|
| 282 | + foreach ($openingCommands as $idx => $def) |
|
| 283 | 283 | { |
| 284 | 284 | $this->commands[] = new CommandDef( |
| 285 | 285 | $def['name'], |
@@ -300,20 +300,20 @@ discard block |
||
| 300 | 300 | $opening = count($openingCommands); |
| 301 | 301 | $closing = count($closingCommands); |
| 302 | 302 | $max = $opening; |
| 303 | - if($closing > $max) { |
|
| 303 | + if ($closing > $max) { |
|
| 304 | 304 | $max = $closing; |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - for($i=0; $i < $max; $i++) |
|
| 307 | + for ($i = 0; $i < $max; $i++) |
|
| 308 | 308 | { |
| 309 | 309 | // command closed that was never opened |
| 310 | - if(!isset($openingCommands[$i])) |
|
| 310 | + if (!isset($openingCommands[$i])) |
|
| 311 | 311 | { |
| 312 | 312 | return $this->addErrorClosedNeverOpened($closingCommands[$i]['matchedText']); |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | // command opened that was never closed |
| 316 | - if(!isset($closingCommands[$i])) |
|
| 316 | + if (!isset($closingCommands[$i])) |
|
| 317 | 317 | { |
| 318 | 318 | return $this->addErrorNeverClosed( |
| 319 | 319 | $openingCommands[$i]['matchedText'], |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | // command closed does not match opening |
| 325 | - if($openingCommands[$i]['name'] !== $closingCommands[$i]['name']) |
|
| 325 | + if ($openingCommands[$i]['name'] !== $closingCommands[$i]['name']) |
|
| 326 | 326 | { |
| 327 | 327 | return $this->addErrorClosingMismatch( |
| 328 | 328 | $openingCommands[$i]['name'], |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | |
| 378 | 378 | $result = array(); |
| 379 | 379 | |
| 380 | - foreach($matches[0] as $idx => $matchedText) |
|
| 380 | + foreach ($matches[0] as $idx => $matchedText) |
|
| 381 | 381 | { |
| 382 | 382 | $result[] = array( |
| 383 | 383 | 'name' => strtolower(trim((string)$matches[1][$idx])), |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | $matchedText, |
| 462 | 462 | t( |
| 463 | 463 | 'The command is never closed with a matching %1$s command.', |
| 464 | - sb()->code('{' . $name . '}') |
|
| 464 | + sb()->code('{'.$name.'}') |
|
| 465 | 465 | ), |
| 466 | 466 | Mailcode_Commands_CommonConstants::VALIDATION_MISSING_CONTENT_CLOSING_TAG |
| 467 | 467 | ); |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | ) |
| 486 | 486 | ->t( |
| 487 | 487 | 'It must be closed with a matching %1$s command.', |
| 488 | - sb()->code('{' . $name . '}') |
|
| 488 | + sb()->code('{'.$name.'}') |
|
| 489 | 489 | ), |
| 490 | 490 | Mailcode_Commands_CommonConstants::VALIDATION_CONTENT_CLOSING_MISMATCHED_TAG |
| 491 | 491 | ); |