@@ -34,13 +34,13 @@ discard block |
||
| 34 | 34 | ->getInfo() |
| 35 | 35 | ->getTokenByParamName(DecryptInterface::PARAMETER_NAME); |
| 36 | 36 | |
| 37 | - if($token === null) { |
|
| 37 | + if ($token === null) { |
|
| 38 | 38 | return; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | if (!$token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral) { |
| 42 | 42 | $this->validationResult->makeError( |
| 43 | - t('Invalid decryption key token:') . ' ' . t('Expected a string.'), |
|
| 43 | + t('Invalid decryption key token:').' '.t('Expected a string.'), |
|
| 44 | 44 | DecryptInterface::VALIDATION_DECRYPT_CODE_WRONG_TYPE |
| 45 | 45 | ); |
| 46 | 46 | } |
@@ -56,20 +56,20 @@ discard block |
||
| 56 | 56 | public function getDecryptionKeyName() : string |
| 57 | 57 | { |
| 58 | 58 | $key = $this->getDecryptionKeyToken(); |
| 59 | - if($key === null) { |
|
| 59 | + if ($key === null) { |
|
| 60 | 60 | return ''; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $keyName = $key->getText(); |
| 64 | 64 | |
| 65 | - if(empty($keyName)) { |
|
| 65 | + if (empty($keyName)) { |
|
| 66 | 66 | $keyName = (string)DecryptSettings::getDefaultKeyName(); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | return $keyName; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - public function enableDecryption(string $keyName=DecryptInterface::DEFAULT_DECRYPTION_KEY_NAME) : self |
|
| 72 | + public function enableDecryption(string $keyName = DecryptInterface::DEFAULT_DECRYPTION_KEY_NAME) : self |
|
| 73 | 73 | { |
| 74 | 74 | $this->decryptionKeyToken = $this |
| 75 | 75 | ->requireParams() |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | public function disableDecryption() : self |
| 83 | 83 | { |
| 84 | - if(isset($this->decryptionKeyToken)) { |
|
| 84 | + if (isset($this->decryptionKeyToken)) { |
|
| 85 | 85 | $this |
| 86 | 86 | ->requireParams() |
| 87 | 87 | ->getInfo() |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | */ |
| 41 | 41 | public function getDecryptionKeyToken(): ?Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral; |
| 42 | 42 | |
| 43 | - public function enableDecryption(string $keyName=DecryptInterface::DEFAULT_DECRYPTION_KEY_NAME) : self; |
|
| 43 | + public function enableDecryption(string $keyName = DecryptInterface::DEFAULT_DECRYPTION_KEY_NAME) : self; |
|
| 44 | 44 | |
| 45 | 45 | public function disableDecryption() : self; |
| 46 | 46 | public function isDecryptionEnabled() : bool; |
@@ -22,11 +22,11 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | class Mailcode_Factory_Instantiator |
| 24 | 24 | { |
| 25 | - public function buildIf(string $ifType, string $params, string $type='') : Mailcode_Commands_IfBase |
|
| 25 | + public function buildIf(string $ifType, string $params, string $type = '') : Mailcode_Commands_IfBase |
|
| 26 | 26 | { |
| 27 | 27 | $stringType = $type; |
| 28 | 28 | |
| 29 | - if(!empty($type)) |
|
| 29 | + if (!empty($type)) |
|
| 30 | 30 | { |
| 31 | 31 | $stringType = ' '.$type; |
| 32 | 32 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | $this->checkCommand($command); |
| 47 | 47 | |
| 48 | - if($command instanceof Mailcode_Commands_IfBase) |
|
| 48 | + if ($command instanceof Mailcode_Commands_IfBase) |
|
| 49 | 49 | { |
| 50 | 50 | return $command; |
| 51 | 51 | } |
@@ -53,16 +53,16 @@ discard block |
||
| 53 | 53 | throw $this->exceptionUnexpectedType('IfBase', $command); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - public function buildIfVar(string $ifType, string $variable, string $operand, string $value, bool $quoteValue=false, bool $insensitive=false) : Mailcode_Commands_IfBase |
|
| 56 | + public function buildIfVar(string $ifType, string $variable, string $operand, string $value, bool $quoteValue = false, bool $insensitive = false) : Mailcode_Commands_IfBase |
|
| 57 | 57 | { |
| 58 | 58 | $variable = $this->filterVariableName($variable); |
| 59 | 59 | |
| 60 | - if($insensitive) |
|
| 60 | + if ($insensitive) |
|
| 61 | 61 | { |
| 62 | 62 | $value = mb_strtolower($value); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - if($quoteValue) |
|
| 65 | + if ($quoteValue) |
|
| 66 | 66 | { |
| 67 | 67 | $value = $this->quoteString($value); |
| 68 | 68 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $value |
| 75 | 75 | ); |
| 76 | 76 | |
| 77 | - if($insensitive) |
|
| 77 | + if ($insensitive) |
|
| 78 | 78 | { |
| 79 | 79 | $condition .= ' '.Mailcode_Commands_Keywords::TYPE_INSENSITIVE; |
| 80 | 80 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * @return Mailcode_Commands_IfBase |
| 103 | 103 | * @throws Mailcode_Factory_Exception |
| 104 | 104 | */ |
| 105 | - public function buildIfContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false, string $containsType='contains') : Mailcode_Commands_IfBase |
|
| 105 | + public function buildIfContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false, string $containsType = 'contains') : Mailcode_Commands_IfBase |
|
| 106 | 106 | { |
| 107 | 107 | $condition = sprintf( |
| 108 | 108 | '%s%s"%s"', |
@@ -114,23 +114,23 @@ discard block |
||
| 114 | 114 | return $this->buildIf($ifType, $condition, $containsType); |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - private function renderListKeywords(bool $caseInsensitive=false, bool $regexEnabled=false) : string |
|
| 117 | + private function renderListKeywords(bool $caseInsensitive = false, bool $regexEnabled = false) : string |
|
| 118 | 118 | { |
| 119 | 119 | $keywords = array(); |
| 120 | 120 | |
| 121 | - if($caseInsensitive) |
|
| 121 | + if ($caseInsensitive) |
|
| 122 | 122 | { |
| 123 | 123 | $keywords[] = Mailcode_Commands_Keywords::TYPE_INSENSITIVE; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - if($regexEnabled) |
|
| 126 | + if ($regexEnabled) |
|
| 127 | 127 | { |
| 128 | 128 | $keywords[] = Mailcode_Commands_Keywords::TYPE_REGEX; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | $keywordsString = ''; |
| 132 | 132 | |
| 133 | - if(!empty($keywords)) |
|
| 133 | + if (!empty($keywords)) |
|
| 134 | 134 | { |
| 135 | 135 | $keywordsString = ' '.implode(' ', $keywords); |
| 136 | 136 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * @return Mailcode_Commands_IfBase |
| 148 | 148 | * @throws Mailcode_Factory_Exception |
| 149 | 149 | */ |
| 150 | - public function buildIfNotContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_IfBase |
|
| 150 | + public function buildIfNotContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_IfBase |
|
| 151 | 151 | { |
| 152 | 152 | return $this->buildIfContains($ifType, $variable, $searchTerms, $caseInsensitive, $regexEnabled, 'not-contains'); |
| 153 | 153 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | * @return Mailcode_Commands_IfBase |
| 163 | 163 | * @throws Mailcode_Factory_Exception |
| 164 | 164 | */ |
| 165 | - public function buildIfListContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false, string $containsType='list-contains') : Mailcode_Commands_IfBase |
|
| 165 | + public function buildIfListContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false, string $containsType = 'list-contains') : Mailcode_Commands_IfBase |
|
| 166 | 166 | { |
| 167 | 167 | return $this->buildIfContains($ifType, $variable, $searchTerms, $caseInsensitive, $regexEnabled, $containsType); |
| 168 | 168 | } |
@@ -176,17 +176,17 @@ discard block |
||
| 176 | 176 | * @return Mailcode_Commands_IfBase |
| 177 | 177 | * @throws Mailcode_Factory_Exception |
| 178 | 178 | */ |
| 179 | - public function buildIfListNotContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_IfBase |
|
| 179 | + public function buildIfListNotContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_IfBase |
|
| 180 | 180 | { |
| 181 | 181 | return $this->buildIfContains($ifType, $variable, $searchTerms, $caseInsensitive, $regexEnabled, 'list-not-contains'); |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - public function buildIfBeginsWith(string $ifType, string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_IfBase |
|
| 184 | + public function buildIfBeginsWith(string $ifType, string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_IfBase |
|
| 185 | 185 | { |
| 186 | 186 | return $this->buildIfSearch($ifType, 'begins-with', $variable, $search, $caseInsensitive); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - public function buildIfEndsWith(string $ifType, string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_IfBase |
|
| 189 | + public function buildIfEndsWith(string $ifType, string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_IfBase |
|
| 190 | 190 | { |
| 191 | 191 | return $this->buildIfSearch($ifType, 'ends-with', $variable, $search, $caseInsensitive); |
| 192 | 192 | } |
@@ -236,11 +236,11 @@ discard block |
||
| 236 | 236 | ); |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - private function buildIfSearch(string $ifType, string $subType, string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_IfBase |
|
| 239 | + private function buildIfSearch(string $ifType, string $subType, string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_IfBase |
|
| 240 | 240 | { |
| 241 | 241 | $keyword = ' '; |
| 242 | 242 | |
| 243 | - if($caseInsensitive) |
|
| 243 | + if ($caseInsensitive) |
|
| 244 | 244 | { |
| 245 | 245 | $keyword = ' '.Mailcode_Commands_Keywords::TYPE_INSENSITIVE; |
| 246 | 246 | } |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | */ |
| 280 | 280 | public function checkCommand(Mailcode_Commands_Command $command) : void |
| 281 | 281 | { |
| 282 | - if($command->isValid()) |
|
| 282 | + if ($command->isValid()) |
|
| 283 | 283 | { |
| 284 | 284 | return; |
| 285 | 285 | } |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | */ |
| 314 | 314 | public function setEncoding(Mailcode_Commands_Command $cmd, string $urlEncoding) : void |
| 315 | 315 | { |
| 316 | - if($cmd instanceof Mailcode_Interfaces_Commands_Validation_URLEncode) |
|
| 316 | + if ($cmd instanceof Mailcode_Interfaces_Commands_Validation_URLEncode) |
|
| 317 | 317 | { |
| 318 | 318 | $cmd->setURLEncoding(false); |
| 319 | 319 | |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | } |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | - if($cmd instanceof Mailcode_Interfaces_Commands_Validation_URLDecode) |
|
| 326 | + if ($cmd instanceof Mailcode_Interfaces_Commands_Validation_URLDecode) |
|
| 327 | 327 | { |
| 328 | 328 | $cmd->setURLDecoding(false); |
| 329 | 329 | |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | */ |
| 343 | 343 | public function quoteString(string $string) : string |
| 344 | 344 | { |
| 345 | - if(substr($string, 0, 1) === '"' && substr($string, -1, 1) === '"') { |
|
| 345 | + if (substr($string, 0, 1) === '"' && substr($string, -1, 1) === '"') { |
|
| 346 | 346 | return $string; |
| 347 | 347 | } |
| 348 | 348 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public function createSyntax(string $name) : Syntax |
| 38 | 38 | { |
| 39 | - if($this->syntaxExists($name)) |
|
| 39 | + if ($this->syntaxExists($name)) |
|
| 40 | 40 | { |
| 41 | 41 | return new Syntax($name); |
| 42 | 42 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $names = $this->getSyntaxNames(); |
| 74 | 74 | $result = array(); |
| 75 | 75 | |
| 76 | - foreach($names as $name) |
|
| 76 | + foreach ($names as $name) |
|
| 77 | 77 | { |
| 78 | 78 | $result[] = $this->createSyntax($name); |
| 79 | 79 | } |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | { |
| 30 | 30 | $varName = undollarize($command->getVariableName()); |
| 31 | 31 | |
| 32 | - if($command->isHTMLEnabled()) |
|
| 32 | + if ($command->isHTMLEnabled()) |
|
| 33 | 33 | { |
| 34 | 34 | $statement = sprintf( |
| 35 | 35 | '%s.replaceAll($esc.newline, "<br/>")', |
@@ -35,8 +35,7 @@ |
||
| 35 | 35 | '%s.replaceAll($esc.newline, "<br/>")', |
| 36 | 36 | $varName |
| 37 | 37 | ); |
| 38 | - } |
|
| 39 | - else |
|
| 38 | + } else |
|
| 40 | 39 | { |
| 41 | 40 | $statement = sprintf( |
| 42 | 41 | '%s', |
@@ -225,27 +225,27 @@ |
||
| 225 | 225 | * @return array<string,string> |
| 226 | 226 | * @throws Mailcode_Exception |
| 227 | 227 | */ |
| 228 | - private function parseVarName() : array |
|
| 229 | - { |
|
| 230 | - $tokens = explode('.', undollarize($this->variable->getFullName())); |
|
| 231 | - |
|
| 232 | - if(count($tokens) === 2) |
|
| 233 | - { |
|
| 234 | - return array( |
|
| 235 | - 'path' => $tokens[0], |
|
| 236 | - 'name' => $tokens[1] |
|
| 237 | - ); |
|
| 238 | - } |
|
| 239 | - |
|
| 240 | - throw new Mailcode_Exception( |
|
| 241 | - 'Invalid variable name for a list property.', |
|
| 242 | - sprintf( |
|
| 243 | - 'Exactly 2 parts are required, variable [%s] has [%s].', |
|
| 244 | - $this->variable->getFullName(), |
|
| 245 | - count($tokens) |
|
| 246 | - ), |
|
| 247 | - self::ERROR_INVALID_LIST_VARIABLE_NAME |
|
| 248 | - ); |
|
| 249 | - } |
|
| 228 | + private function parseVarName() : array |
|
| 229 | + { |
|
| 230 | + $tokens = explode('.', undollarize($this->variable->getFullName())); |
|
| 231 | + |
|
| 232 | + if(count($tokens) === 2) |
|
| 233 | + { |
|
| 234 | + return array( |
|
| 235 | + 'path' => $tokens[0], |
|
| 236 | + 'name' => $tokens[1] |
|
| 237 | + ); |
|
| 238 | + } |
|
| 239 | + |
|
| 240 | + throw new Mailcode_Exception( |
|
| 241 | + 'Invalid variable name for a list property.', |
|
| 242 | + sprintf( |
|
| 243 | + 'Exactly 2 parts are required, variable [%s] has [%s].', |
|
| 244 | + $this->variable->getFullName(), |
|
| 245 | + count($tokens) |
|
| 246 | + ), |
|
| 247 | + self::ERROR_INVALID_LIST_VARIABLE_NAME |
|
| 248 | + ); |
|
| 249 | + } |
|
| 250 | 250 | } |
| 251 | 251 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function getSign() : string |
| 74 | 74 | { |
| 75 | - if($this->isNotContains()) |
|
| 75 | + if ($this->isNotContains()) |
|
| 76 | 76 | { |
| 77 | 77 | return '!'; |
| 78 | 78 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function getConnector() : string |
| 91 | 91 | { |
| 92 | - if($this->isNotContains()) |
|
| 92 | + if ($this->isNotContains()) |
|
| 93 | 93 | { |
| 94 | 94 | return '&&'; |
| 95 | 95 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | { |
| 106 | 106 | $parts = array(); |
| 107 | 107 | |
| 108 | - foreach($this->searchTerms as $token) |
|
| 108 | + foreach ($this->searchTerms as $token) |
|
| 109 | 109 | { |
| 110 | 110 | $parts[] = $this->renderCommand($token); |
| 111 | 111 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | private function renderCommand(Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral $searchTerm) : string |
| 122 | 122 | { |
| 123 | - if($this->isList()) |
|
| 123 | + if ($this->isList()) |
|
| 124 | 124 | { |
| 125 | 125 | $command = $this->renderListCommand($searchTerm); |
| 126 | 126 | } |
@@ -161,14 +161,14 @@ discard block |
||
| 161 | 161 | private function renderRegex(Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral $searchTerm) : string |
| 162 | 162 | { |
| 163 | 163 | $opts = 's'; |
| 164 | - if($this->caseSensitive) |
|
| 164 | + if ($this->caseSensitive) |
|
| 165 | 165 | { |
| 166 | 166 | $opts = 'is'; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | $filtered = trim($searchTerm->getNormalized(), '"'); |
| 170 | 170 | |
| 171 | - if(!$this->regexEnabled) |
|
| 171 | + if (!$this->regexEnabled) |
|
| 172 | 172 | { |
| 173 | 173 | $filtered = $this->translator->filterRegexString($filtered); |
| 174 | 174 | $filtered = $this->addWildcards($filtered); |
@@ -191,17 +191,17 @@ discard block |
||
| 191 | 191 | */ |
| 192 | 192 | private function addWildcards(string $searchTerm) : string |
| 193 | 193 | { |
| 194 | - if($this->containsType === 'list-begins-with') |
|
| 194 | + if ($this->containsType === 'list-begins-with') |
|
| 195 | 195 | { |
| 196 | 196 | return $searchTerm.'.*'; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - if($this->containsType === 'list-ends-with') |
|
| 199 | + if ($this->containsType === 'list-ends-with') |
|
| 200 | 200 | { |
| 201 | 201 | return '.*'.$searchTerm; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - if($this->containsType === 'list-equals') |
|
| 204 | + if ($this->containsType === 'list-equals') |
|
| 205 | 205 | { |
| 206 | 206 | return '\A'.$searchTerm.'\Z'; |
| 207 | 207 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | { |
| 218 | 218 | $tokens = explode('.', undollarize($this->variable->getFullName())); |
| 219 | 219 | |
| 220 | - if(count($tokens) === 2) |
|
| 220 | + if (count($tokens) === 2) |
|
| 221 | 221 | { |
| 222 | 222 | return array( |
| 223 | 223 | 'path' => $tokens[0], |
@@ -120,8 +120,7 @@ |
||
| 120 | 120 | if($this->isList()) |
| 121 | 121 | { |
| 122 | 122 | $command = $this->renderListCommand($searchTerm); |
| 123 | - } |
|
| 124 | - else |
|
| 123 | + } else |
|
| 125 | 124 | { |
| 126 | 125 | $command = $this->renderRegularCommand($searchTerm); |
| 127 | 126 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | // This ending command is tied to a preprocessing command: Since |
| 26 | 26 | // we do not want to keep these, we return an empty string to strip |
| 27 | 27 | // it out. |
| 28 | - if($command->getOpeningCommand() instanceof Mailcode_Interfaces_Commands_PreProcessing) { |
|
| 28 | + if ($command->getOpeningCommand() instanceof Mailcode_Interfaces_Commands_PreProcessing) { |
|
| 29 | 29 | return ''; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | // IF type. |
| 46 | 46 | $method = 'translate'.$this->getIfType($command); |
| 47 | 47 | |
| 48 | - if(method_exists($this, $method)) |
|
| 48 | + if (method_exists($this, $method)) |
|
| 49 | 49 | { |
| 50 | 50 | return (string)$this->$method($command); |
| 51 | 51 | } |
@@ -65,11 +65,11 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | $keywords = $command->getLogicKeywords()->getKeywords(); |
| 67 | 67 | |
| 68 | - foreach($keywords as $keyword) |
|
| 68 | + foreach ($keywords as $keyword) |
|
| 69 | 69 | { |
| 70 | 70 | $keyCommand = $keyword->getCommand(); |
| 71 | 71 | |
| 72 | - if($keyCommand instanceof Mailcode_Commands_IfBase) |
|
| 72 | + if ($keyCommand instanceof Mailcode_Commands_IfBase) |
|
| 73 | 73 | { |
| 74 | 74 | $body .= ' '.$this->getSign($keyword).' '.$this->translateBody($keyCommand); |
| 75 | 75 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | protected function getSign(Mailcode_Commands_LogicKeywords_Keyword $keyword) : string |
| 99 | 99 | { |
| 100 | - switch($keyword->getName()) |
|
| 100 | + switch ($keyword->getName()) |
|
| 101 | 101 | { |
| 102 | 102 | case 'and': |
| 103 | 103 | return '&&'; |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | { |
| 131 | 131 | $sign = ''; |
| 132 | 132 | |
| 133 | - if($notEmpty) |
|
| 133 | + if ($notEmpty) |
|
| 134 | 134 | { |
| 135 | 135 | $sign = '!'; |
| 136 | 136 | } |
@@ -146,12 +146,12 @@ discard block |
||
| 146 | 146 | { |
| 147 | 147 | $params = $command->getParams(); |
| 148 | 148 | |
| 149 | - if(!$params) |
|
| 149 | + if (!$params) |
|
| 150 | 150 | { |
| 151 | 151 | return ''; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - if($command->hasFreeformParameters()) |
|
| 154 | + if ($command->hasFreeformParameters()) |
|
| 155 | 155 | { |
| 156 | 156 | return $params->getStatementString(); |
| 157 | 157 | } |
@@ -159,18 +159,18 @@ discard block |
||
| 159 | 159 | return $params->getNormalized(); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - protected function _translateVariable(Mailcode_Variables_Variable $variable, string $comparator, string $value, bool $insensitive=false) : string |
|
| 162 | + protected function _translateVariable(Mailcode_Variables_Variable $variable, string $comparator, string $value, bool $insensitive = false) : string |
|
| 163 | 163 | { |
| 164 | 164 | $booleanCheck = strtolower(trim($value, '"')); |
| 165 | 165 | $fullName = $variable->getFullName(); |
| 166 | 166 | |
| 167 | - if(in_array($booleanCheck, array('true', 'false'))) |
|
| 167 | + if (in_array($booleanCheck, array('true', 'false'))) |
|
| 168 | 168 | { |
| 169 | 169 | $insensitive = true; |
| 170 | 170 | $value = '"'.$booleanCheck.'"'; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - if($insensitive) |
|
| 173 | + if ($insensitive) |
|
| 174 | 174 | { |
| 175 | 175 | $fullName .= '.toLowerCase()'; |
| 176 | 176 | $value = mb_strtolower($value); |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | protected function _translateSearch(string $mode, Mailcode_Variables_Variable $variable, bool $caseSensitive, string $searchTerm) : string |
| 203 | 203 | { |
| 204 | 204 | $method = $mode.'With'; |
| 205 | - if($caseSensitive) |
|
| 205 | + if ($caseSensitive) |
|
| 206 | 206 | { |
| 207 | 207 | $method = $mode.'WithIgnoreCase'; |
| 208 | 208 | } |
@@ -40,8 +40,7 @@ |
||
| 40 | 40 | if($keyCommand instanceof Mailcode_Commands_IfBase) |
| 41 | 41 | { |
| 42 | 42 | $body .= ' '.$this->getSign($keyword).' '.$this->translateBody($keyCommand); |
| 43 | - } |
|
| 44 | - else |
|
| 43 | + } else |
|
| 45 | 44 | { |
| 46 | 45 | throw new Mailcode_Exception( |
| 47 | 46 | 'Keyword command type does not match expected base class.', |
@@ -48,16 +48,16 @@ |
||
| 48 | 48 | $statements = array(); |
| 49 | 49 | $statements[] = $this->renderURL($urlVar); |
| 50 | 50 | |
| 51 | - if($command->isTrackingEnabled()) |
|
| 51 | + if ($command->isTrackingEnabled()) |
|
| 52 | 52 | { |
| 53 | 53 | $statements[] = $this->renderTracking($command); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - if($command->hasQueryParams()) |
|
| 56 | + if ($command->hasQueryParams()) |
|
| 57 | 57 | { |
| 58 | 58 | $params = $command->getQueryParams(); |
| 59 | 59 | |
| 60 | - foreach($params as $name => $value) |
|
| 60 | + foreach ($params as $name => $value) |
|
| 61 | 61 | { |
| 62 | 62 | $statements[] = $this->renderQueryParam($name, $value); |
| 63 | 63 | } |