@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | $this->caseInsensitive = $val->isValid(); |
| 42 | 42 | |
| 43 | - if($val->isValid()) |
|
| 43 | + if ($val->isValid()) |
|
| 44 | 44 | { |
| 45 | 45 | $this->caseToken = $val->getToken(); |
| 46 | 46 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | public function getCaseToken() : ?Mailcode_Parser_Statement_Tokenizer_Token_Keyword |
| 55 | 55 | { |
| 56 | - if($this->caseToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 56 | + if ($this->caseToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 57 | 57 | { |
| 58 | 58 | return $this->caseToken; |
| 59 | 59 | } |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | |
| 81 | 81 | protected function validateSyntax_comment() : void |
| 82 | 82 | { |
| 83 | - if(empty($this->commentString)) |
|
| 83 | + if (empty($this->commentString)) |
|
| 84 | 84 | { |
| 85 | 85 | $this->validationResult->makeError( |
| 86 | 86 | t('The comment text ist empty.'), |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | $val = $this->validator->createVariable()->setIndex(0); |
| 75 | 75 | |
| 76 | - if($val->isValid()) |
|
| 76 | + if ($val->isValid()) |
|
| 77 | 77 | { |
| 78 | 78 | $this->variableToken = $val->getToken(); |
| 79 | 79 | } |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | $tokens = $this->params->getInfo()->createPruner()->limitToOperands()->getTokens(); |
| 92 | 92 | |
| 93 | - foreach($tokens as $token) |
|
| 93 | + foreach ($tokens as $token) |
|
| 94 | 94 | { |
| 95 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
| 95 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
| 96 | 96 | { |
| 97 | 97 | $this->validateOperand($token); |
| 98 | 98 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | // ensure that the operand we have in the command is one of the |
| 110 | 110 | // allowed ones. |
| 111 | - if(!in_array($sign, $allowed)) |
|
| 111 | + if (!in_array($sign, $allowed)) |
|
| 112 | 112 | { |
| 113 | 113 | $this->validationResult->makeError( |
| 114 | 114 | t('The %1$s sign is not allowed in this command.', '<code>'.$sign.'</code>'), |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | { |
| 122 | 122 | $tokens = $this->getAssignmentTokens(); |
| 123 | 123 | |
| 124 | - if(empty($tokens)) |
|
| 124 | + if (empty($tokens)) |
|
| 125 | 125 | { |
| 126 | 126 | $this->validationResult->makeError( |
| 127 | 127 | t('No value assigned to the variable.'), |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | public function getVariable() : Mailcode_Variables_Variable |
| 134 | 134 | { |
| 135 | - if($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
| 135 | + if ($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
| 136 | 136 | { |
| 137 | 137 | return $this->variableToken->getVariable(); |
| 138 | 138 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | $eq = array_shift($params); // equals sign |
| 157 | 157 | |
| 158 | 158 | // in case the equals sign was omitted. |
| 159 | - if(!$eq instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
| 159 | + if (!$eq instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
| 160 | 160 | { |
| 161 | 161 | array_unshift($params, $eq); |
| 162 | 162 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | $items = array(); |
| 172 | 172 | |
| 173 | - foreach($tokens as $token) |
|
| 173 | + foreach ($tokens as $token) |
|
| 174 | 174 | { |
| 175 | 175 | $items[] = $token->getNormalized(); |
| 176 | 176 | } |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | |
| 33 | 33 | public function requiresAdjustment(): bool |
| 34 | 34 | { |
| 35 | - if(!parent::requiresAdjustment()) |
|
| 35 | + if (!parent::requiresAdjustment()) |
|
| 36 | 36 | { |
| 37 | 37 | return false; |
| 38 | 38 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | public function applyFormatting() : void |
| 133 | 133 | { |
| 134 | - if($this->applied) |
|
| 134 | + if ($this->applied) |
|
| 135 | 135 | { |
| 136 | 136 | return; |
| 137 | 137 | } |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | private function applyFormatTypes() : void |
| 148 | 148 | { |
| 149 | - foreach($this->formatters as $formatter) |
|
| 149 | + foreach ($this->formatters as $formatter) |
|
| 150 | 150 | { |
| 151 | - if($formatter instanceof Mailcode_Parser_Safeguard_Formatter_FormatType) |
|
| 151 | + if ($formatter instanceof Mailcode_Parser_Safeguard_Formatter_FormatType) |
|
| 152 | 152 | { |
| 153 | 153 | $formatter->format(); |
| 154 | 154 | } |
@@ -157,9 +157,9 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | private function applyReplaceTypes() : void |
| 159 | 159 | { |
| 160 | - foreach($this->formatters as $formatter) |
|
| 160 | + foreach ($this->formatters as $formatter) |
|
| 161 | 161 | { |
| 162 | - if($formatter instanceof Mailcode_Parser_Safeguard_Formatter_ReplacerType) |
|
| 162 | + if ($formatter instanceof Mailcode_Parser_Safeguard_Formatter_ReplacerType) |
|
| 163 | 163 | { |
| 164 | 164 | $formatter->replace(); |
| 165 | 165 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | private function validateFormatters() : void |
| 170 | 170 | { |
| 171 | - if(empty($this->formatters)) |
|
| 171 | + if (empty($this->formatters)) |
|
| 172 | 172 | { |
| 173 | 173 | throw new Mailcode_Exception( |
| 174 | 174 | 'No formatters selected', |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | $amount = $this->countReplacers(); |
| 181 | 181 | |
| 182 | - if($amount > 1) |
|
| 182 | + if ($amount > 1) |
|
| 183 | 183 | { |
| 184 | 184 | throw new Mailcode_Exception( |
| 185 | 185 | 'More than one replacer formatter selected', |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | // by default, at minimum the normalized formatter must be selected. |
| 192 | - if($amount === 0) |
|
| 192 | + if ($amount === 0) |
|
| 193 | 193 | { |
| 194 | 194 | $this->replaceWithNormalized(); |
| 195 | 195 | } |
@@ -204,9 +204,9 @@ discard block |
||
| 204 | 204 | { |
| 205 | 205 | $count = 0; |
| 206 | 206 | |
| 207 | - foreach($this->formatters as $formatter) |
|
| 207 | + foreach ($this->formatters as $formatter) |
|
| 208 | 208 | { |
| 209 | - if($formatter instanceof Mailcode_Parser_Safeguard_Formatter_ReplacerType) |
|
| 209 | + if ($formatter instanceof Mailcode_Parser_Safeguard_Formatter_ReplacerType) |
|
| 210 | 210 | { |
| 211 | 211 | $count++; |
| 212 | 212 | } |
@@ -88,12 +88,12 @@ discard block |
||
| 88 | 88 | public function updateString(string $subject) : bool |
| 89 | 89 | { |
| 90 | 90 | // avoid triggering an update if there are no changes in the string |
| 91 | - if($subject === $this->subject) |
|
| 91 | + if ($subject === $this->subject) |
|
| 92 | 92 | { |
| 93 | 93 | return false; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - if($this->updating) |
|
| 96 | + if ($this->updating) |
|
| 97 | 97 | { |
| 98 | 98 | throw new Mailcode_Exception( |
| 99 | 99 | 'Cannot modify subject string during update', |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $this->subject = $subject; |
| 108 | 108 | $this->length = mb_strlen($this->subject); |
| 109 | 109 | |
| 110 | - foreach($this->listeners as $listener) |
|
| 110 | + foreach ($this->listeners as $listener) |
|
| 111 | 111 | { |
| 112 | 112 | $listener($this); |
| 113 | 113 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | { |
| 143 | 143 | self::$listenerCounter++; |
| 144 | 144 | |
| 145 | - if(!is_callable($callback)) |
|
| 145 | + if (!is_callable($callback)) |
|
| 146 | 146 | { |
| 147 | 147 | throw new Mailcode_Exception( |
| 148 | 148 | 'Not a valid callable', |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | public function removeListener(int $listenerID) : void |
| 174 | 174 | { |
| 175 | - if(isset($this->listeners[$listenerID])) |
|
| 175 | + if (isset($this->listeners[$listenerID])) |
|
| 176 | 176 | { |
| 177 | 177 | unset($this->listeners[$listenerID]); |
| 178 | 178 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | return mb_strpos($this->subject, $needle); |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - public function getSubstr(int $start, ?int $length=null) : string |
|
| 206 | + public function getSubstr(int $start, ?int $length = null) : string |
|
| 207 | 207 | { |
| 208 | 208 | return mb_substr($this->subject, $start, $length); |
| 209 | 209 | } |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | { |
| 35 | 35 | $locations = $this->resolveLocations(); |
| 36 | 36 | |
| 37 | - foreach($locations as $location) |
|
| 37 | + foreach ($locations as $location) |
|
| 38 | 38 | { |
| 39 | 39 | $location->format(); |
| 40 | 40 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | $locations = $this->resolveLocations(); |
| 31 | 31 | |
| 32 | - foreach($locations as $location) |
|
| 32 | + foreach ($locations as $location) |
|
| 33 | 33 | { |
| 34 | 34 | $location->replaceWith($this->resolveReplacement($location)); |
| 35 | 35 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | private function resolveReplacement(Mailcode_Parser_Safeguard_Formatter_Location $location) : string |
| 48 | 48 | { |
| 49 | - if($location->requiresAdjustment()) |
|
| 49 | + if ($location->requiresAdjustment()) |
|
| 50 | 50 | { |
| 51 | 51 | return $this->getReplaceString($location); |
| 52 | 52 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | $instance = new $class($this, $placeholder); |
| 79 | 79 | |
| 80 | - if($instance instanceof Mailcode_Parser_Safeguard_Formatter_Location) |
|
| 80 | + if ($instance instanceof Mailcode_Parser_Safeguard_Formatter_Location) |
|
| 81 | 81 | { |
| 82 | 82 | return $instance; |
| 83 | 83 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | $result = array(); |
| 107 | 107 | |
| 108 | - foreach($placeholders as $placeholder) |
|
| 108 | + foreach ($placeholders as $placeholder) |
|
| 109 | 109 | { |
| 110 | 110 | $result[] = $this->createLocation($placeholder); |
| 111 | 111 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | { |
| 124 | 124 | $eol = ConvertHelper::detectEOLCharacter($subject); |
| 125 | 125 | |
| 126 | - if($eol) |
|
| 126 | + if ($eol) |
|
| 127 | 127 | { |
| 128 | 128 | $this->log(sprintf( |
| 129 | 129 | 'Detected EOL character: %s.', |