@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $error = null; |
| 31 | 31 | $activeSyntax = $syntaxes[0]->getTypeID(); |
| 32 | 32 | |
| 33 | -if($request->getBool('translate')) |
|
| 33 | +if ($request->getBool('translate')) |
|
| 34 | 34 | { |
| 35 | 35 | $commandsText = $request->getParam('mailcode'); |
| 36 | 36 | $activeSyntax = (string)$request->registerParam('syntax') |
@@ -47,12 +47,12 @@ discard block |
||
| 47 | 47 | $error = $e->getMessage(); |
| 48 | 48 | |
| 49 | 49 | $collection = $e->getCollection(); |
| 50 | - if($collection) |
|
| 50 | + if ($collection) |
|
| 51 | 51 | { |
| 52 | 52 | $first = $collection->getFirstError(); |
| 53 | 53 | $error = $first->getMessage(); |
| 54 | 54 | $matched = $first->getMatchedText(); |
| 55 | - if(!empty($matched)) { |
|
| 55 | + if (!empty($matched)) { |
|
| 56 | 56 | $error .= '<br>'.t('In command:').' <code>'.$matched.'</code>'; |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $selected = ''; |
| 120 | 120 | $typeID = $syntax->getTypeID(); |
| 121 | 121 | |
| 122 | - if($typeID === $activeSyntax) { |
|
| 122 | + if ($typeID === $activeSyntax) { |
|
| 123 | 123 | $selected = ' selected'; |
| 124 | 124 | } |
| 125 | 125 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | <p></p><br> |
| 140 | 140 | <h2><?php pt('Translated commands') ?></h2> |
| 141 | 141 | <?php |
| 142 | - if(empty($commandsText)) |
|
| 142 | + if (empty($commandsText)) |
|
| 143 | 143 | { |
| 144 | 144 | ?> |
| 145 | 145 | <div class="alert alert-info"> |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | </div> |
| 148 | 148 | <?php |
| 149 | 149 | } |
| 150 | - else if($error) |
|
| 150 | + else if ($error) |
|
| 151 | 151 | { |
| 152 | 152 | ?> |
| 153 | 153 | <div class="alert alert-danger"> |
@@ -40,8 +40,7 @@ discard block |
||
| 40 | 40 | try |
| 41 | 41 | { |
| 42 | 42 | $translated = translateMailcode($commandsText, $activeSyntax); |
| 43 | - } |
|
| 44 | - catch (Mailcode_Exception $e) |
|
| 43 | + } catch (Mailcode_Exception $e) |
|
| 45 | 44 | { |
| 46 | 45 | $translated = ''; |
| 47 | 46 | $error = $e->getMessage(); |
@@ -146,8 +145,7 @@ discard block |
||
| 146 | 145 | <?php pt('No commands specified.') ?> |
| 147 | 146 | </div> |
| 148 | 147 | <?php |
| 149 | - } |
|
| 150 | - else if($error) |
|
| 148 | + } else if($error) |
|
| 151 | 149 | { |
| 152 | 150 | ?> |
| 153 | 151 | <div class="alert alert-danger"> |
@@ -155,8 +153,7 @@ discard block |
||
| 155 | 153 | <?php echo $error ?> |
| 156 | 154 | </div> |
| 157 | 155 | <?php |
| 158 | - } |
|
| 159 | - else |
|
| 156 | + } else |
|
| 160 | 157 | { |
| 161 | 158 | ?> |
| 162 | 159 | <textarea class="form-control" rows="10"><?php echo htmlspecialchars($translated) ?></textarea> |
@@ -20,11 +20,11 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | class Mailcode_Factory_CommandSets_Set_If extends Mailcode_Factory_CommandSets_IfBase |
| 22 | 22 | { |
| 23 | - public function if(string $condition, string $type='') : Mailcode_Commands_Command_If |
|
| 23 | + public function if (string $condition, string $type = '') : Mailcode_Commands_Command_If |
|
| 24 | 24 | { |
| 25 | 25 | $command = $this->instantiator->buildIf('If', $condition, $type); |
| 26 | 26 | |
| 27 | - if($command instanceof Mailcode_Commands_Command_If) |
|
| 27 | + if ($command instanceof Mailcode_Commands_Command_If) |
|
| 28 | 28 | { |
| 29 | 29 | return $command; |
| 30 | 30 | } |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | throw $this->instantiator->exceptionUnexpectedType('If', $command); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function var(string $variable, string $operand, string $value, bool $quoteValue=false, bool $insensitive=false) : Mailcode_Commands_Command_If_Variable |
|
| 35 | + public function var(string $variable, string $operand, string $value, bool $quoteValue = false, bool $insensitive = false) : Mailcode_Commands_Command_If_Variable |
|
| 36 | 36 | { |
| 37 | 37 | $command = $this->instantiator->buildIfVar('If', $variable, $operand, $value, $quoteValue, $insensitive); |
| 38 | 38 | |
| 39 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 39 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 40 | 40 | { |
| 41 | 41 | return $command; |
| 42 | 42 | } |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | throw $this->instantiator->exceptionUnexpectedType('IfVar', $command); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function varString(string $variable, string $operand, string $value, bool $insensitive=false) : Mailcode_Commands_Command_If_Variable |
|
| 47 | + public function varString(string $variable, string $operand, string $value, bool $insensitive = false) : Mailcode_Commands_Command_If_Variable |
|
| 48 | 48 | { |
| 49 | 49 | $command = $this->instantiator->buildIfVar('If', $variable, $operand, $value, true, $insensitive); |
| 50 | 50 | |
| 51 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 51 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 52 | 52 | { |
| 53 | 53 | return $command; |
| 54 | 54 | } |
@@ -56,11 +56,11 @@ discard block |
||
| 56 | 56 | throw $this->instantiator->exceptionUnexpectedType('IfVarString', $command); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - public function varEquals(string $variable, string $value, bool $quoteValue=false, bool $insensitive=false) : Mailcode_Commands_Command_If_Variable |
|
| 59 | + public function varEquals(string $variable, string $value, bool $quoteValue = false, bool $insensitive = false) : Mailcode_Commands_Command_If_Variable |
|
| 60 | 60 | { |
| 61 | 61 | $command = $this->instantiator->buildIfVar('If', $variable, '==', $value, $quoteValue, $insensitive); |
| 62 | 62 | |
| 63 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 63 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 64 | 64 | { |
| 65 | 65 | return $command; |
| 66 | 66 | } |
@@ -68,11 +68,11 @@ discard block |
||
| 68 | 68 | throw $this->instantiator->exceptionUnexpectedType('IfVarEquals', $command); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function varEqualsString(string $variable, string $value, bool $insensitive=false) : Mailcode_Commands_Command_If |
|
| 71 | + public function varEqualsString(string $variable, string $value, bool $insensitive = false) : Mailcode_Commands_Command_If |
|
| 72 | 72 | { |
| 73 | 73 | $command = $this->instantiator->buildIfVar('If', $variable, '==', $value, true, $insensitive); |
| 74 | 74 | |
| 75 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 75 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 76 | 76 | { |
| 77 | 77 | return $command; |
| 78 | 78 | } |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | throw $this->instantiator->exceptionUnexpectedType('IfarEqualsString', $command); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - public function varNotEquals(string $variable, string $value, bool $quoteValue=false, bool $insensitive=false) : Mailcode_Commands_Command_If_Variable |
|
| 83 | + public function varNotEquals(string $variable, string $value, bool $quoteValue = false, bool $insensitive = false) : Mailcode_Commands_Command_If_Variable |
|
| 84 | 84 | { |
| 85 | 85 | $command = $this->instantiator->buildIfVar('If', $variable, '!=', $value, $quoteValue, $insensitive); |
| 86 | 86 | |
| 87 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 87 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 88 | 88 | { |
| 89 | 89 | return $command; |
| 90 | 90 | } |
@@ -92,11 +92,11 @@ discard block |
||
| 92 | 92 | throw $this->instantiator->exceptionUnexpectedType('IfVarNotEquals', $command); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - public function varNotEqualsString(string $variable, string $value, bool $insensitive=false) : Mailcode_Commands_Command_If_Variable |
|
| 95 | + public function varNotEqualsString(string $variable, string $value, bool $insensitive = false) : Mailcode_Commands_Command_If_Variable |
|
| 96 | 96 | { |
| 97 | 97 | $command = $this->instantiator->buildIfVar('If', $variable, '!=', $value, true, $insensitive); |
| 98 | 98 | |
| 99 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 99 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 100 | 100 | { |
| 101 | 101 | return $command; |
| 102 | 102 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | { |
| 109 | 109 | $command = $this->instantiator->buildIfEmpty('If', $variable); |
| 110 | 110 | |
| 111 | - if($command instanceof Mailcode_Commands_Command_If_Empty) |
|
| 111 | + if ($command instanceof Mailcode_Commands_Command_If_Empty) |
|
| 112 | 112 | { |
| 113 | 113 | return $command; |
| 114 | 114 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | { |
| 121 | 121 | $command = $this->instantiator->buildIfNotEmpty('If', $variable); |
| 122 | 122 | |
| 123 | - if($command instanceof Mailcode_Commands_Command_If_NotEmpty) |
|
| 123 | + if ($command instanceof Mailcode_Commands_Command_If_NotEmpty) |
|
| 124 | 124 | { |
| 125 | 125 | return $command; |
| 126 | 126 | } |
@@ -135,11 +135,11 @@ discard block |
||
| 135 | 135 | * @return Mailcode_Commands_Command_If_Contains |
| 136 | 136 | * @throws Mailcode_Factory_Exception |
| 137 | 137 | */ |
| 138 | - public function contains(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_Contains |
|
| 138 | + public function contains(string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_Contains |
|
| 139 | 139 | { |
| 140 | 140 | $command = $this->instantiator->buildIfContains('If', $variable, $searchTerms, $caseInsensitive); |
| 141 | 141 | |
| 142 | - if($command instanceof Mailcode_Commands_Command_If_Contains) |
|
| 142 | + if ($command instanceof Mailcode_Commands_Command_If_Contains) |
|
| 143 | 143 | { |
| 144 | 144 | return $command; |
| 145 | 145 | } |
@@ -154,11 +154,11 @@ discard block |
||
| 154 | 154 | * @return Mailcode_Commands_Command_If_NotContains |
| 155 | 155 | * @throws Mailcode_Factory_Exception |
| 156 | 156 | */ |
| 157 | - public function notContains(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_NotContains |
|
| 157 | + public function notContains(string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_NotContains |
|
| 158 | 158 | { |
| 159 | 159 | $command = $this->instantiator->buildIfNotContains('If', $variable, $searchTerms, $caseInsensitive); |
| 160 | 160 | |
| 161 | - if($command instanceof Mailcode_Commands_Command_If_NotContains) |
|
| 161 | + if ($command instanceof Mailcode_Commands_Command_If_NotContains) |
|
| 162 | 162 | { |
| 163 | 163 | return $command; |
| 164 | 164 | } |
@@ -174,11 +174,11 @@ discard block |
||
| 174 | 174 | * @return Mailcode_Commands_Command_If_ListContains |
| 175 | 175 | * @throws Mailcode_Factory_Exception |
| 176 | 176 | */ |
| 177 | - public function listContains(string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_Command_If_ListContains |
|
| 177 | + public function listContains(string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_Command_If_ListContains |
|
| 178 | 178 | { |
| 179 | 179 | $command = $this->instantiator->buildIfListContains('If', $variable, $searchTerms, $caseInsensitive, $regexEnabled, 'list-contains'); |
| 180 | 180 | |
| 181 | - if($command instanceof Mailcode_Commands_Command_If_ListContains) |
|
| 181 | + if ($command instanceof Mailcode_Commands_Command_If_ListContains) |
|
| 182 | 182 | { |
| 183 | 183 | return $command; |
| 184 | 184 | } |
@@ -193,11 +193,11 @@ discard block |
||
| 193 | 193 | * @return Mailcode_Commands_Command_If_ListEquals |
| 194 | 194 | * @throws Mailcode_Factory_Exception |
| 195 | 195 | */ |
| 196 | - public function listEquals(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_ListEquals |
|
| 196 | + public function listEquals(string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_ListEquals |
|
| 197 | 197 | { |
| 198 | 198 | $command = $this->instantiator->buildIfListContains('If', $variable, $searchTerms, $caseInsensitive, false, 'list-equals'); |
| 199 | 199 | |
| 200 | - if($command instanceof Mailcode_Commands_Command_If_ListEquals) |
|
| 200 | + if ($command instanceof Mailcode_Commands_Command_If_ListEquals) |
|
| 201 | 201 | { |
| 202 | 202 | return $command; |
| 203 | 203 | } |
@@ -213,11 +213,11 @@ discard block |
||
| 213 | 213 | * @return Mailcode_Commands_Command_If_ListNotContains |
| 214 | 214 | * @throws Mailcode_Factory_Exception |
| 215 | 215 | */ |
| 216 | - public function listNotContains(string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_Command_If_ListNotContains |
|
| 216 | + public function listNotContains(string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_Command_If_ListNotContains |
|
| 217 | 217 | { |
| 218 | 218 | $command = $this->instantiator->buildIfListNotContains('If', $variable, $searchTerms, $caseInsensitive, $regexEnabled); |
| 219 | 219 | |
| 220 | - if($command instanceof Mailcode_Commands_Command_If_ListNotContains) |
|
| 220 | + if ($command instanceof Mailcode_Commands_Command_If_ListNotContains) |
|
| 221 | 221 | { |
| 222 | 222 | return $command; |
| 223 | 223 | } |
@@ -233,11 +233,11 @@ discard block |
||
| 233 | 233 | * @return Mailcode_Commands_Command_If_ListBeginsWith |
| 234 | 234 | * @throws Mailcode_Factory_Exception |
| 235 | 235 | */ |
| 236 | - public function listBeginsWith(string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_Command_If_ListBeginsWith |
|
| 236 | + public function listBeginsWith(string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_Command_If_ListBeginsWith |
|
| 237 | 237 | { |
| 238 | - $command = $this->instantiator->buildIfListContains('If', $variable, $searchTerms, $caseInsensitive, $regexEnabled,'list-begins-with'); |
|
| 238 | + $command = $this->instantiator->buildIfListContains('If', $variable, $searchTerms, $caseInsensitive, $regexEnabled, 'list-begins-with'); |
|
| 239 | 239 | |
| 240 | - if($command instanceof Mailcode_Commands_Command_If_ListBeginsWith) |
|
| 240 | + if ($command instanceof Mailcode_Commands_Command_If_ListBeginsWith) |
|
| 241 | 241 | { |
| 242 | 242 | return $command; |
| 243 | 243 | } |
@@ -253,11 +253,11 @@ discard block |
||
| 253 | 253 | * @return Mailcode_Commands_Command_If_ListEndsWith |
| 254 | 254 | * @throws Mailcode_Factory_Exception |
| 255 | 255 | */ |
| 256 | - public function listEndsWith(string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_Command_If_ListEndsWith |
|
| 256 | + public function listEndsWith(string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_Command_If_ListEndsWith |
|
| 257 | 257 | { |
| 258 | - $command = $this->instantiator->buildIfListContains('If', $variable, $searchTerms, $caseInsensitive, $regexEnabled,'list-ends-with'); |
|
| 258 | + $command = $this->instantiator->buildIfListContains('If', $variable, $searchTerms, $caseInsensitive, $regexEnabled, 'list-ends-with'); |
|
| 259 | 259 | |
| 260 | - if($command instanceof Mailcode_Commands_Command_If_ListEndsWith) |
|
| 260 | + if ($command instanceof Mailcode_Commands_Command_If_ListEndsWith) |
|
| 261 | 261 | { |
| 262 | 262 | return $command; |
| 263 | 263 | } |
@@ -265,11 +265,11 @@ discard block |
||
| 265 | 265 | throw $this->instantiator->exceptionUnexpectedType('IfListEndsWith', $command); |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - public function beginsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_BeginsWith |
|
| 268 | + public function beginsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_BeginsWith |
|
| 269 | 269 | { |
| 270 | 270 | $command = $this->instantiator->buildIfBeginsWith('If', $variable, $search, $caseInsensitive); |
| 271 | 271 | |
| 272 | - if($command instanceof Mailcode_Commands_Command_If_BeginsWith) |
|
| 272 | + if ($command instanceof Mailcode_Commands_Command_If_BeginsWith) |
|
| 273 | 273 | { |
| 274 | 274 | return $command; |
| 275 | 275 | } |
@@ -277,11 +277,11 @@ discard block |
||
| 277 | 277 | throw $this->instantiator->exceptionUnexpectedType('IfBeginsWith', $command); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - public function endsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_EndsWith |
|
| 280 | + public function endsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_EndsWith |
|
| 281 | 281 | { |
| 282 | 282 | $command = $this->instantiator->buildIfEndsWith('If', $variable, $search, $caseInsensitive); |
| 283 | 283 | |
| 284 | - if($command instanceof Mailcode_Commands_Command_If_EndsWith) |
|
| 284 | + if ($command instanceof Mailcode_Commands_Command_If_EndsWith) |
|
| 285 | 285 | { |
| 286 | 286 | return $command; |
| 287 | 287 | } |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | { |
| 294 | 294 | $command = $this->instantiator->buildIfBiggerThan('If', $variable, $value); |
| 295 | 295 | |
| 296 | - if($command instanceof Mailcode_Commands_Command_If_BiggerThan) |
|
| 296 | + if ($command instanceof Mailcode_Commands_Command_If_BiggerThan) |
|
| 297 | 297 | { |
| 298 | 298 | return $command; |
| 299 | 299 | } |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | { |
| 306 | 306 | $command = $this->instantiator->buildIfSmallerThan('If', $variable, $value); |
| 307 | 307 | |
| 308 | - if($command instanceof Mailcode_Commands_Command_If_SmallerThan) |
|
| 308 | + if ($command instanceof Mailcode_Commands_Command_If_SmallerThan) |
|
| 309 | 309 | { |
| 310 | 310 | return $command; |
| 311 | 311 | } |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | { |
| 318 | 318 | $command = $this->instantiator->buildIfEquals('If', $variable, $value); |
| 319 | 319 | |
| 320 | - if($command instanceof Mailcode_Commands_Command_If_EqualsNumber) |
|
| 320 | + if ($command instanceof Mailcode_Commands_Command_If_EqualsNumber) |
|
| 321 | 321 | { |
| 322 | 322 | return $command; |
| 323 | 323 | } |
@@ -20,11 +20,11 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | class Mailcode_Factory_CommandSets_Set_ElseIf extends Mailcode_Factory_CommandSets_IfBase |
| 22 | 22 | { |
| 23 | - public function elseIf(string $condition, string $type='') : Mailcode_Commands_Command_ElseIf |
|
| 23 | + public function elseIf (string $condition, string $type = '') : Mailcode_Commands_Command_ElseIf |
|
| 24 | 24 | { |
| 25 | 25 | $command = $this->instantiator->buildIf('ElseIf', $condition, $type); |
| 26 | 26 | |
| 27 | - if($command instanceof Mailcode_Commands_Command_ElseIf) |
|
| 27 | + if ($command instanceof Mailcode_Commands_Command_ElseIf) |
|
| 28 | 28 | { |
| 29 | 29 | return $command; |
| 30 | 30 | } |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | throw $this->instantiator->exceptionUnexpectedType('ElseIf', $command); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function var(string $variable, string $operand, string $value, bool $quoteValue=false, bool $insensitive=false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 35 | + public function var(string $variable, string $operand, string $value, bool $quoteValue = false, bool $insensitive = false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 36 | 36 | { |
| 37 | 37 | $command = $this->instantiator->buildIfVar('ElseIf', $variable, $operand, $value, $quoteValue, $insensitive); |
| 38 | 38 | |
| 39 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 39 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 40 | 40 | { |
| 41 | 41 | return $command; |
| 42 | 42 | } |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | throw $this->instantiator->exceptionUnexpectedType('ElseIfVariable', $command); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function varString(string $variable, string $operand, string $value, bool $insensitive=false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 47 | + public function varString(string $variable, string $operand, string $value, bool $insensitive = false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 48 | 48 | { |
| 49 | 49 | $command = $this->instantiator->buildIfVar('ElseIf', $variable, $operand, $value, true, $insensitive); |
| 50 | 50 | |
| 51 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 51 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 52 | 52 | { |
| 53 | 53 | return $command; |
| 54 | 54 | } |
@@ -56,11 +56,11 @@ discard block |
||
| 56 | 56 | throw $this->instantiator->exceptionUnexpectedType('ElseIfVarString', $command); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - public function varEquals(string $variable, string $value, bool $quoteValue=false, bool $insensitive=false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 59 | + public function varEquals(string $variable, string $value, bool $quoteValue = false, bool $insensitive = false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 60 | 60 | { |
| 61 | 61 | $command = $this->instantiator->buildIfVar('ElseIf', $variable, '==', $value, $quoteValue, $insensitive); |
| 62 | 62 | |
| 63 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 63 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 64 | 64 | { |
| 65 | 65 | return $command; |
| 66 | 66 | } |
@@ -68,11 +68,11 @@ discard block |
||
| 68 | 68 | throw $this->instantiator->exceptionUnexpectedType('ElseIfVarEquals', $command); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function varEqualsString(string $variable, string $value, bool $insensitive=false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 71 | + public function varEqualsString(string $variable, string $value, bool $insensitive = false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 72 | 72 | { |
| 73 | 73 | $command = $this->instantiator->buildIfVar('ElseIf', $variable, '==', $value, true, $insensitive); |
| 74 | 74 | |
| 75 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 75 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 76 | 76 | { |
| 77 | 77 | return $command; |
| 78 | 78 | } |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | throw $this->instantiator->exceptionUnexpectedType('ElseIfVarEqualsString', $command); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - public function varNotEquals(string $variable, string $value, bool $quoteValue=false, bool $insensitive=false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 83 | + public function varNotEquals(string $variable, string $value, bool $quoteValue = false, bool $insensitive = false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 84 | 84 | { |
| 85 | 85 | $command = $this->instantiator->buildIfVar('ElseIf', $variable, '!=', $value, $quoteValue, $insensitive); |
| 86 | 86 | |
| 87 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 87 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 88 | 88 | { |
| 89 | 89 | return $command; |
| 90 | 90 | } |
@@ -92,11 +92,11 @@ discard block |
||
| 92 | 92 | throw $this->instantiator->exceptionUnexpectedType('ElseIfVarNotEquals', $command); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - public function varNotEqualsString(string $variable, string $value, bool $insensitive=false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 95 | + public function varNotEqualsString(string $variable, string $value, bool $insensitive = false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 96 | 96 | { |
| 97 | 97 | $command = $this->instantiator->buildIfVar('ElseIf', $variable, '!=', $value, true, $insensitive); |
| 98 | 98 | |
| 99 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 99 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 100 | 100 | { |
| 101 | 101 | return $command; |
| 102 | 102 | } |
@@ -111,11 +111,11 @@ discard block |
||
| 111 | 111 | * @return Mailcode_Commands_Command_ElseIf_Contains |
| 112 | 112 | * @throws Mailcode_Factory_Exception |
| 113 | 113 | */ |
| 114 | - public function contains(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_Contains |
|
| 114 | + public function contains(string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_Contains |
|
| 115 | 115 | { |
| 116 | 116 | $command = $this->instantiator->buildIfContains('ElseIf', $variable, $searchTerms, $caseInsensitive); |
| 117 | 117 | |
| 118 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Contains) |
|
| 118 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Contains) |
|
| 119 | 119 | { |
| 120 | 120 | return $command; |
| 121 | 121 | } |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | * @return Mailcode_Commands_Command_ElseIf_NotContains |
| 131 | 131 | * @throws Mailcode_Factory_Exception |
| 132 | 132 | */ |
| 133 | - public function notContains(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_NotContains |
|
| 133 | + public function notContains(string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_NotContains |
|
| 134 | 134 | { |
| 135 | 135 | $command = $this->instantiator->buildIfNotContains('ElseIf', $variable, $searchTerms, $caseInsensitive); |
| 136 | 136 | |
| 137 | - if($command instanceof Mailcode_Commands_Command_ElseIf_NotContains) |
|
| 137 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_NotContains) |
|
| 138 | 138 | { |
| 139 | 139 | return $command; |
| 140 | 140 | } |
@@ -150,11 +150,11 @@ discard block |
||
| 150 | 150 | * @return Mailcode_Commands_Command_ElseIf_ListContains |
| 151 | 151 | * @throws Mailcode_Factory_Exception |
| 152 | 152 | */ |
| 153 | - public function listContains(string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_Command_ElseIf_ListContains |
|
| 153 | + public function listContains(string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_Command_ElseIf_ListContains |
|
| 154 | 154 | { |
| 155 | 155 | $command = $this->instantiator->buildIfListContains('ElseIf', $variable, $searchTerms, $caseInsensitive, $regexEnabled); |
| 156 | 156 | |
| 157 | - if($command instanceof Mailcode_Commands_Command_ElseIf_ListContains) |
|
| 157 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_ListContains) |
|
| 158 | 158 | { |
| 159 | 159 | return $command; |
| 160 | 160 | } |
@@ -169,11 +169,11 @@ discard block |
||
| 169 | 169 | * @return Mailcode_Commands_Command_ElseIf_ListEquals |
| 170 | 170 | * @throws Mailcode_Factory_Exception |
| 171 | 171 | */ |
| 172 | - public function listEquals(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_ListEquals |
|
| 172 | + public function listEquals(string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_ListEquals |
|
| 173 | 173 | { |
| 174 | 174 | $command = $this->instantiator->buildIfListContains('ElseIf', $variable, $searchTerms, $caseInsensitive, false, 'list-equals'); |
| 175 | 175 | |
| 176 | - if($command instanceof Mailcode_Commands_Command_ElseIf_ListEquals) |
|
| 176 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_ListEquals) |
|
| 177 | 177 | { |
| 178 | 178 | return $command; |
| 179 | 179 | } |
@@ -189,11 +189,11 @@ discard block |
||
| 189 | 189 | * @return Mailcode_Commands_Command_ElseIf_ListNotContains |
| 190 | 190 | * @throws Mailcode_Factory_Exception |
| 191 | 191 | */ |
| 192 | - public function listNotContains(string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_Command_ElseIf_ListNotContains |
|
| 192 | + public function listNotContains(string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_Command_ElseIf_ListNotContains |
|
| 193 | 193 | { |
| 194 | 194 | $command = $this->instantiator->buildIfListNotContains('ElseIf', $variable, $searchTerms, $caseInsensitive, $regexEnabled); |
| 195 | 195 | |
| 196 | - if($command instanceof Mailcode_Commands_Command_ElseIf_ListNotContains) |
|
| 196 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_ListNotContains) |
|
| 197 | 197 | { |
| 198 | 198 | return $command; |
| 199 | 199 | } |
@@ -209,11 +209,11 @@ discard block |
||
| 209 | 209 | * @return Mailcode_Commands_Command_ElseIf_ListBeginsWith |
| 210 | 210 | * @throws Mailcode_Factory_Exception |
| 211 | 211 | */ |
| 212 | - public function listBeginsWith(string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_Command_ElseIf_ListBeginsWith |
|
| 212 | + public function listBeginsWith(string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_Command_ElseIf_ListBeginsWith |
|
| 213 | 213 | { |
| 214 | 214 | $command = $this->instantiator->buildIfListContains('ElseIf', $variable, $searchTerms, $caseInsensitive, $regexEnabled, 'list-begins-with'); |
| 215 | 215 | |
| 216 | - if($command instanceof Mailcode_Commands_Command_ElseIf_ListBeginsWith) |
|
| 216 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_ListBeginsWith) |
|
| 217 | 217 | { |
| 218 | 218 | return $command; |
| 219 | 219 | } |
@@ -229,11 +229,11 @@ discard block |
||
| 229 | 229 | * @return Mailcode_Commands_Command_ElseIf_ListEndsWith |
| 230 | 230 | * @throws Mailcode_Factory_Exception |
| 231 | 231 | */ |
| 232 | - public function listEndsWith(string $variable, array $searchTerms, bool $caseInsensitive=false, bool $regexEnabled=false) : Mailcode_Commands_Command_ElseIf_ListEndsWith |
|
| 232 | + public function listEndsWith(string $variable, array $searchTerms, bool $caseInsensitive = false, bool $regexEnabled = false) : Mailcode_Commands_Command_ElseIf_ListEndsWith |
|
| 233 | 233 | { |
| 234 | 234 | $command = $this->instantiator->buildIfListContains('ElseIf', $variable, $searchTerms, $caseInsensitive, $regexEnabled, 'list-ends-with'); |
| 235 | 235 | |
| 236 | - if($command instanceof Mailcode_Commands_Command_ElseIf_ListEndsWith) |
|
| 236 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_ListEndsWith) |
|
| 237 | 237 | { |
| 238 | 238 | return $command; |
| 239 | 239 | } |
@@ -241,11 +241,11 @@ discard block |
||
| 241 | 241 | throw $this->instantiator->exceptionUnexpectedType('ElseIfListEndsWith', $command); |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - public function beginsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_BeginsWith |
|
| 244 | + public function beginsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_BeginsWith |
|
| 245 | 245 | { |
| 246 | 246 | $command = $this->instantiator->buildIfBeginsWith('ElseIf', $variable, $search, $caseInsensitive); |
| 247 | 247 | |
| 248 | - if($command instanceof Mailcode_Commands_Command_ElseIf_BeginsWith) |
|
| 248 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_BeginsWith) |
|
| 249 | 249 | { |
| 250 | 250 | return $command; |
| 251 | 251 | } |
@@ -253,11 +253,11 @@ discard block |
||
| 253 | 253 | throw $this->instantiator->exceptionUnexpectedType('ElseIfBeginsWith', $command); |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - public function endsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_EndsWith |
|
| 256 | + public function endsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_EndsWith |
|
| 257 | 257 | { |
| 258 | 258 | $command = $this->instantiator->buildIfEndsWith('ElseIf', $variable, $search, $caseInsensitive); |
| 259 | 259 | |
| 260 | - if($command instanceof Mailcode_Commands_Command_ElseIf_EndsWith) |
|
| 260 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_EndsWith) |
|
| 261 | 261 | { |
| 262 | 262 | return $command; |
| 263 | 263 | } |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | { |
| 270 | 270 | $command = $this->instantiator->buildIfEmpty('ElseIf', $variable); |
| 271 | 271 | |
| 272 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Empty) |
|
| 272 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Empty) |
|
| 273 | 273 | { |
| 274 | 274 | return $command; |
| 275 | 275 | } |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | { |
| 282 | 282 | $command = $this->instantiator->buildIfNotEmpty('ElseIf', $variable); |
| 283 | 283 | |
| 284 | - if($command instanceof Mailcode_Commands_Command_ElseIf_NotEmpty) |
|
| 284 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_NotEmpty) |
|
| 285 | 285 | { |
| 286 | 286 | return $command; |
| 287 | 287 | } |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | { |
| 294 | 294 | $command = $this->instantiator->buildIfBiggerThan('ElseIf', $variable, $value); |
| 295 | 295 | |
| 296 | - if($command instanceof Mailcode_Commands_Command_ElseIf_BiggerThan) |
|
| 296 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_BiggerThan) |
|
| 297 | 297 | { |
| 298 | 298 | return $command; |
| 299 | 299 | } |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | { |
| 306 | 306 | $command = $this->instantiator->buildIfSmallerThan('ElseIf', $variable, $value); |
| 307 | 307 | |
| 308 | - if($command instanceof Mailcode_Commands_Command_ElseIf_SmallerThan) |
|
| 308 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_SmallerThan) |
|
| 309 | 309 | { |
| 310 | 310 | return $command; |
| 311 | 311 | } |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | { |
| 318 | 318 | $command = $this->instantiator->buildIfEquals('ElseIf', $variable, $value); |
| 319 | 319 | |
| 320 | - if($command instanceof Mailcode_Commands_Command_ElseIf_EqualsNumber) |
|
| 320 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_EqualsNumber) |
|
| 321 | 321 | { |
| 322 | 322 | return $command; |
| 323 | 323 | } |
@@ -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', |
@@ -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/>")', |
@@ -31,27 +31,27 @@ discard block |
||
| 31 | 31 | public const VALIDATION_CANNOT_MIX_LOGIC_KEYWORDS = 60701; |
| 32 | 32 | public const VALIDATION_INVALID_SUB_COMMAND = 60702; |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @var string |
|
| 36 | - */ |
|
| 34 | + /** |
|
| 35 | + * @var string |
|
| 36 | + */ |
|
| 37 | 37 | private $paramsString; |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @var string[] |
|
| 41 | - */ |
|
| 39 | + /** |
|
| 40 | + * @var string[] |
|
| 41 | + */ |
|
| 42 | 42 | private $names = array( |
| 43 | 43 | 'and', |
| 44 | 44 | 'or' |
| 45 | 45 | ); |
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * @var Mailcode_Commands_LogicKeywords_Keyword[] |
|
| 49 | - */ |
|
| 47 | + /** |
|
| 48 | + * @var Mailcode_Commands_LogicKeywords_Keyword[] |
|
| 49 | + */ |
|
| 50 | 50 | private $keywords = array(); |
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * @var string |
|
| 54 | - */ |
|
| 52 | + /** |
|
| 53 | + * @var string |
|
| 54 | + */ |
|
| 55 | 55 | private $mainParams = ''; |
| 56 | 56 | |
| 57 | 57 | public function __construct(Mailcode_Commands_Command $command, string $paramsString) |
@@ -137,9 +137,9 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - /** |
|
| 141 | - * @return string[] |
|
| 142 | - */ |
|
| 140 | + /** |
|
| 141 | + * @return string[] |
|
| 142 | + */ |
|
| 143 | 143 | private function detectParameters() : array |
| 144 | 144 | { |
| 145 | 145 | $params = $this->paramsString; |
@@ -157,13 +157,13 @@ discard block |
||
| 157 | 157 | return $stack; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - /** |
|
| 161 | - * @param string $params |
|
| 162 | - * @param Mailcode_Commands_LogicKeywords_Keyword $keyword |
|
| 163 | - * @param string[] $stack |
|
| 164 | - * @throws Mailcode_Exception |
|
| 165 | - * @return string |
|
| 166 | - */ |
|
| 160 | + /** |
|
| 161 | + * @param string $params |
|
| 162 | + * @param Mailcode_Commands_LogicKeywords_Keyword $keyword |
|
| 163 | + * @param string[] $stack |
|
| 164 | + * @throws Mailcode_Exception |
|
| 165 | + * @return string |
|
| 166 | + */ |
|
| 167 | 167 | private function detectParamsKeyword(string $params, Mailcode_Commands_LogicKeywords_Keyword $keyword, array &$stack) : string |
| 168 | 168 | { |
| 169 | 169 | $search = $keyword->getMatchedString(); |
@@ -188,22 +188,22 @@ discard block |
||
| 188 | 188 | return $params; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - /** |
|
| 192 | - * Extracts the parameters string to use for the |
|
| 193 | - * original command itself, omitting all the logic |
|
| 194 | - * keywords for the sub-commands. |
|
| 195 | - * |
|
| 196 | - * @return string |
|
| 197 | - */ |
|
| 191 | + /** |
|
| 192 | + * Extracts the parameters string to use for the |
|
| 193 | + * original command itself, omitting all the logic |
|
| 194 | + * keywords for the sub-commands. |
|
| 195 | + * |
|
| 196 | + * @return string |
|
| 197 | + */ |
|
| 198 | 198 | public function getMainParamsString() : string |
| 199 | 199 | { |
| 200 | 200 | return $this->mainParams; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - /** |
|
| 204 | - * Retrieves the detected keyword names. |
|
| 205 | - * @return string[] |
|
| 206 | - */ |
|
| 203 | + /** |
|
| 204 | + * Retrieves the detected keyword names. |
|
| 205 | + * @return string[] |
|
| 206 | + */ |
|
| 207 | 207 | public function getDetectedNames() : array |
| 208 | 208 | { |
| 209 | 209 | $names = array(); |
@@ -221,23 +221,23 @@ discard block |
||
| 221 | 221 | return $names; |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - /** |
|
| 225 | - * Retrieves all keywords that were detected in the |
|
| 226 | - * command's parameters string, if any. |
|
| 227 | - * |
|
| 228 | - * @return Mailcode_Commands_LogicKeywords_Keyword[] |
|
| 229 | - */ |
|
| 224 | + /** |
|
| 225 | + * Retrieves all keywords that were detected in the |
|
| 226 | + * command's parameters string, if any. |
|
| 227 | + * |
|
| 228 | + * @return Mailcode_Commands_LogicKeywords_Keyword[] |
|
| 229 | + */ |
|
| 230 | 230 | public function getKeywords() : array |
| 231 | 231 | { |
| 232 | 232 | return $this->keywords; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - /** |
|
| 236 | - * Detects any keyword statements in the parameters by keyword name. |
|
| 237 | - * |
|
| 238 | - * @param string $name |
|
| 239 | - * @return Mailcode_Commands_LogicKeywords_Keyword[] |
|
| 240 | - */ |
|
| 235 | + /** |
|
| 236 | + * Detects any keyword statements in the parameters by keyword name. |
|
| 237 | + * |
|
| 238 | + * @param string $name |
|
| 239 | + * @return Mailcode_Commands_LogicKeywords_Keyword[] |
|
| 240 | + */ |
|
| 241 | 241 | private function detectKeywords(string $name) : array |
| 242 | 242 | { |
| 243 | 243 | $regex = sprintf('/%1$s\s+([a-z\-0-9]+):|%1$s:/x', $name); |
@@ -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 | } |
@@ -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 | } |
@@ -32,34 +32,34 @@ |
||
| 32 | 32 | public const VALIDATION_ERROR_PATH_UNDERSCORE = 48203; |
| 33 | 33 | public const VALIDATION_ERROR_NAME_UNDERSCORE = 48204; |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @var string |
|
| 37 | - */ |
|
| 35 | + /** |
|
| 36 | + * @var string |
|
| 37 | + */ |
|
| 38 | 38 | protected string $path; |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @var string |
|
| 42 | - */ |
|
| 40 | + /** |
|
| 41 | + * @var string |
|
| 42 | + */ |
|
| 43 | 43 | protected string $name; |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @var string |
|
| 47 | - */ |
|
| 45 | + /** |
|
| 46 | + * @var string |
|
| 47 | + */ |
|
| 48 | 48 | protected string $matchedText; |
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @var string |
|
| 52 | - */ |
|
| 50 | + /** |
|
| 51 | + * @var string |
|
| 52 | + */ |
|
| 53 | 53 | protected string $hash = ''; |
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * @var OperationResult|NULL |
|
| 57 | - */ |
|
| 55 | + /** |
|
| 56 | + * @var OperationResult|NULL |
|
| 57 | + */ |
|
| 58 | 58 | protected ?OperationResult $validationResult = null; |
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @var array<string> |
|
| 62 | - */ |
|
| 60 | + /** |
|
| 61 | + * @var array<string> |
|
| 62 | + */ |
|
| 63 | 63 | protected $validations = array( |
| 64 | 64 | 'number_path', |
| 65 | 65 | 'number_name', |
@@ -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 dollarize($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 | } |
@@ -26,24 +26,24 @@ discard block |
||
| 26 | 26 | public const VALIDATION_EMPTY = 48801; |
| 27 | 27 | public const VALIDATION_UNQUOTED_STRING_LITERALS = 48802; |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * @var string |
|
| 31 | - */ |
|
| 29 | + /** |
|
| 30 | + * @var string |
|
| 31 | + */ |
|
| 32 | 32 | protected string $statement; |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @var OperationResult |
|
| 36 | - */ |
|
| 34 | + /** |
|
| 35 | + * @var OperationResult |
|
| 36 | + */ |
|
| 37 | 37 | protected OperationResult $result; |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @var Mailcode_Parser_Statement_Tokenizer |
|
| 41 | - */ |
|
| 39 | + /** |
|
| 40 | + * @var Mailcode_Parser_Statement_Tokenizer |
|
| 41 | + */ |
|
| 42 | 42 | protected Mailcode_Parser_Statement_Tokenizer $tokenizer; |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @var Mailcode_Parser_Statement_Info|NULL |
|
| 46 | - */ |
|
| 44 | + /** |
|
| 45 | + * @var Mailcode_Parser_Statement_Info|NULL |
|
| 46 | + */ |
|
| 47 | 47 | protected ?Mailcode_Parser_Statement_Info $info = null; |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | if($unknown) |
| 139 | 139 | { |
| 140 | 140 | $this->result->makeError( |
| 141 | - t('Unquoted string literal found:').' ('.htmlspecialchars($unknown->getMatchedText()).')', |
|
| 141 | + t('Unquoted string literal found:').' ('.htmlspecialchars($unknown->getMatchedText()).')', |
|
| 142 | 142 | self::VALIDATION_UNQUOTED_STRING_LITERALS |
| 143 | 143 | ); |
| 144 | 144 | } |
@@ -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; |