@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | $id = $token->getID(); |
48 | 48 | |
49 | - if(!in_array($id, $this->exclude)) |
|
49 | + if (!in_array($id, $this->exclude)) |
|
50 | 50 | { |
51 | 51 | $this->exclude[] = $id; |
52 | 52 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | public function limitByClassName(string $className) : Mailcode_Parser_Statement_Info_Pruner |
68 | 68 | { |
69 | - if(!in_array($className, $this->classNames)) |
|
69 | + if (!in_array($className, $this->classNames)) |
|
70 | 70 | { |
71 | 71 | $this->classNames[] = $className; |
72 | 72 | } |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | $tokens = $this->info->getTokens(); |
86 | 86 | $keep = array(); |
87 | 87 | |
88 | - foreach($tokens as $token) |
|
88 | + foreach ($tokens as $token) |
|
89 | 89 | { |
90 | - if(in_array($token->getID(), $this->exclude)) |
|
90 | + if (in_array($token->getID(), $this->exclude)) |
|
91 | 91 | { |
92 | 92 | continue; |
93 | 93 | } |
@@ -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.'), |
@@ -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.', |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $position = $this->getStartPosition(); |
56 | 56 | |
57 | 57 | // we're at the beginning of the string |
58 | - if($position === false || $position === 0) |
|
58 | + if ($position === false || $position === 0) |
|
59 | 59 | { |
60 | 60 | $this->log(sprintf( |
61 | 61 | 'Prepend: NO | Position: [%s] | Not found, or at beginning of string.', |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | $prevPos = $position - $this->eolLength; |
69 | 69 | |
70 | - if($prevPos < 0) |
|
70 | + if ($prevPos < 0) |
|
71 | 71 | { |
72 | 72 | $prevPos = 0; |
73 | 73 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | protected function checkPreviousPosition(int $prevPos) : void |
79 | 79 | { |
80 | - if($this->isWithinCommand($prevPos)) |
|
80 | + if ($this->isWithinCommand($prevPos)) |
|
81 | 81 | { |
82 | 82 | $this->log(sprintf( |
83 | 83 | 'Prepend: NO | Position: [%s] | Is within a mailcode command.', |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | $match = $this->subject->getSubstr($prevPos, $this->eolLength); |
91 | 91 | |
92 | - if($match !== $this->formatter->getEOLChar()) |
|
92 | + if ($match !== $this->formatter->getEOLChar()) |
|
93 | 93 | { |
94 | 94 | $this->log(sprintf( |
95 | 95 | 'Prepend: YES | Position: [%s] | Characters: [%s] | Do not match the EOL character.', |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $position = $this->getEndPosition(); |
109 | 109 | |
110 | 110 | // we're at the end of the string |
111 | - if($position === false || $position >= $subjectLength) |
|
111 | + if ($position === false || $position >= $subjectLength) |
|
112 | 112 | { |
113 | 113 | $this->log(sprintf( |
114 | 114 | 'Append: NO | Position: [%s] | End of string, or too long | Subject length: [%s]', |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | $nextPos = $position + $this->eolLength; |
123 | 123 | |
124 | - if($nextPos > $subjectLength) |
|
124 | + if ($nextPos > $subjectLength) |
|
125 | 125 | { |
126 | 126 | $nextPos = $subjectLength - $this->eolLength; |
127 | 127 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | protected function checkNextPosition(int $nextPos) : void |
133 | 133 | { |
134 | - if($this->isWithinCommand($nextPos)) |
|
134 | + if ($this->isWithinCommand($nextPos)) |
|
135 | 135 | { |
136 | 136 | $this->log(sprintf( |
137 | 137 | 'Append: YES | Position: [%s] | Is within a mailcode command.', |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | $next = $this->subject->getSubstr($nextPos, $this->eolLength); |
147 | 147 | |
148 | - if($next !== $this->formatter->getEOLChar()) |
|
148 | + if ($next !== $this->formatter->getEOLChar()) |
|
149 | 149 | { |
150 | 150 | $this->log(sprintf( |
151 | 151 | 'Append: YES | Position: [%s] | Next characters: [%s] | Do not match the EOL character.', |