@@ -84,15 +84,15 @@ discard block |
||
84 | 84 | { |
85 | 85 | $literals = $this->params->getInfo()->getStringLiterals(); |
86 | 86 | |
87 | - if(empty($literals)) { |
|
87 | + if (empty($literals)) { |
|
88 | 88 | return; |
89 | 89 | } |
90 | 90 | |
91 | - foreach($literals as $literal) |
|
91 | + foreach ($literals as $literal) |
|
92 | 92 | { |
93 | 93 | $parts = ConvertHelper::explodeTrim(' ', $literal->getText()); |
94 | 94 | |
95 | - foreach($parts as $part) { |
|
95 | + foreach ($parts as $part) { |
|
96 | 96 | $this->addClass($part); |
97 | 97 | } |
98 | 98 | } |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | { |
107 | 107 | $className = trim($className); |
108 | 108 | |
109 | - if($this->isClassNameValid($className)) |
|
109 | + if ($this->isClassNameValid($className)) |
|
110 | 110 | { |
111 | - if(!in_array($className, $this->classes)) { |
|
111 | + if (!in_array($className, $this->classes)) { |
|
112 | 112 | $this->classes[] = $className; |
113 | 113 | } |
114 | 114 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | public function preProcessOpening(): string |
142 | 142 | { |
143 | - if($this->isMultiline()) { |
|
143 | + if ($this->isMultiline()) { |
|
144 | 144 | return sprintf('<pre%s>', $this->renderAttributes()); |
145 | 145 | } |
146 | 146 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | public function preProcessClosing(): string |
151 | 151 | { |
152 | - if($this->isMultiline()) { |
|
152 | + if ($this->isMultiline()) { |
|
153 | 153 | return '</pre>'; |
154 | 154 | } |
155 | 155 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | private function renderAttributes() : string |
160 | 160 | { |
161 | - if(empty($this->classes)) { |
|
161 | + if (empty($this->classes)) { |
|
162 | 162 | return ''; |
163 | 163 | } |
164 | 164 |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | |
61 | 61 | $commands = $this->collection->getCommands(); |
62 | 62 | |
63 | - foreach($commands as $command) |
|
63 | + foreach ($commands as $command) |
|
64 | 64 | { |
65 | 65 | $method = 'validate_'.$command->getCommandType(); |
66 | 66 | |
67 | - if(!method_exists($this, $method)) |
|
67 | + if (!method_exists($this, $method)) |
|
68 | 68 | { |
69 | 69 | throw new Mailcode_Exception( |
70 | 70 | 'Unknown command type validation method.', |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | |
80 | 80 | $this->$method($command); |
81 | 81 | |
82 | - if(!$this->validationResult->isValid()) |
|
82 | + if (!$this->validationResult->isValid()) |
|
83 | 83 | { |
84 | 84 | break; |
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
88 | - if($this->validationResult->isValid()) |
|
88 | + if ($this->validationResult->isValid()) |
|
89 | 89 | { |
90 | 90 | $this->validate_Unclosed(); |
91 | 91 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | { |
98 | 98 | $leftover = $this->getOpenCommand(); |
99 | 99 | |
100 | - if($leftover === null) |
|
100 | + if ($leftover === null) |
|
101 | 101 | { |
102 | 102 | return; |
103 | 103 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | protected function getOpenCommand() : ?Mailcode_Commands_Command_Type_Opening |
115 | 115 | { |
116 | - if(empty($this->stack)) |
|
116 | + if (empty($this->stack)) |
|
117 | 117 | { |
118 | 118 | return null; |
119 | 119 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | $cmd = $this->stack[$idx]; |
126 | 126 | |
127 | - if($cmd instanceof Mailcode_Commands_Command_Type_Opening) |
|
127 | + if ($cmd instanceof Mailcode_Commands_Command_Type_Opening) |
|
128 | 128 | { |
129 | 129 | return $cmd; |
130 | 130 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | { |
149 | 149 | $parent = $this->getOpenCommand(); |
150 | 150 | |
151 | - if($parent === null) |
|
151 | + if ($parent === null) |
|
152 | 152 | { |
153 | 153 | $this->validationResult->makeError( |
154 | 154 | t( |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | return; |
163 | 163 | } |
164 | 164 | |
165 | - if($parent->getName() !== $command->getParentName()) |
|
165 | + if ($parent->getName() !== $command->getParentName()) |
|
166 | 166 | { |
167 | 167 | $this->validationResult->makeError( |
168 | 168 | t( |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | |
185 | 185 | protected function validate_Closing(Mailcode_Commands_Command_Type_Closing $command) : void |
186 | 186 | { |
187 | - if(empty($this->stack)) |
|
187 | + if (empty($this->stack)) |
|
188 | 188 | { |
189 | 189 | $this->validationResult->makeError( |
190 | 190 | t('All open commands have already been ended.'), |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | $openingCommand = array_pop($this->stack); |
198 | 198 | |
199 | - if($openingCommand instanceof Mailcode_Commands_Command_Type_Opening) |
|
199 | + if ($openingCommand instanceof Mailcode_Commands_Command_Type_Opening) |
|
200 | 200 | { |
201 | 201 | $this->log(sprintf('Closing command %s', $openingCommand->getName())); |
202 | 202 |
@@ -25,16 +25,16 @@ |
||
25 | 25 | { |
26 | 26 | $command = $location->getPlaceholder()->getCommand(); |
27 | 27 | |
28 | - if($command instanceof Mailcode_Interfaces_Commands_PreProcessing) |
|
28 | + if ($command instanceof Mailcode_Interfaces_Commands_PreProcessing) |
|
29 | 29 | { |
30 | 30 | return $command->preProcessOpening(); |
31 | 31 | } |
32 | 32 | |
33 | - if($command instanceof Mailcode_Commands_Command_Type_Closing) |
|
33 | + if ($command instanceof Mailcode_Commands_Command_Type_Closing) |
|
34 | 34 | { |
35 | 35 | $opening = $command->getOpeningCommand(); |
36 | 36 | |
37 | - if($opening instanceof Mailcode_Interfaces_Commands_PreProcessing) { |
|
37 | + if ($opening instanceof Mailcode_Interfaces_Commands_PreProcessing) { |
|
38 | 38 | return $opening->preProcessClosing(); |
39 | 39 | } |
40 | 40 | } |
@@ -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 |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function getSign() : string |
86 | 86 | { |
87 | - if($this->isNotContains()) |
|
87 | + if ($this->isNotContains()) |
|
88 | 88 | { |
89 | 89 | return '!'; |
90 | 90 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function getConnector() |
103 | 103 | { |
104 | - if($this->isNotContains()) |
|
104 | + if ($this->isNotContains()) |
|
105 | 105 | { |
106 | 106 | return '&&'; |
107 | 107 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | { |
118 | 118 | $parts = array(); |
119 | 119 | |
120 | - foreach($this->searchTerms as $token) |
|
120 | + foreach ($this->searchTerms as $token) |
|
121 | 121 | { |
122 | 122 | $parts[] = $this->renderCommand($token); |
123 | 123 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | private function renderCommand(Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral $searchTerm) : string |
134 | 134 | { |
135 | - if($this->isList()) |
|
135 | + if ($this->isList()) |
|
136 | 136 | { |
137 | 137 | $command = $this->renderListCommand($searchTerm); |
138 | 138 | } |
@@ -173,14 +173,14 @@ discard block |
||
173 | 173 | private function renderRegex(Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral $searchTerm) : string |
174 | 174 | { |
175 | 175 | $opts = 's'; |
176 | - if($this->caseSensitive) |
|
176 | + if ($this->caseSensitive) |
|
177 | 177 | { |
178 | 178 | $opts = 'is'; |
179 | 179 | } |
180 | 180 | |
181 | 181 | $filtered = trim($searchTerm->getNormalized(), '"'); |
182 | 182 | |
183 | - if(!$this->regexEnabled) |
|
183 | + if (!$this->regexEnabled) |
|
184 | 184 | { |
185 | 185 | $filtered = $this->translator->filterRegexString($filtered); |
186 | 186 | $filtered = $this->addWildcards($filtered); |
@@ -203,17 +203,17 @@ discard block |
||
203 | 203 | */ |
204 | 204 | private function addWildcards(string $searchTerm) : string |
205 | 205 | { |
206 | - if($this->containsType === 'list-begins-with') |
|
206 | + if ($this->containsType === 'list-begins-with') |
|
207 | 207 | { |
208 | 208 | return $searchTerm.'.*'; |
209 | 209 | } |
210 | 210 | |
211 | - if($this->containsType === 'list-ends-with') |
|
211 | + if ($this->containsType === 'list-ends-with') |
|
212 | 212 | { |
213 | 213 | return '.*'.$searchTerm; |
214 | 214 | } |
215 | 215 | |
216 | - if($this->containsType === 'list-equals') |
|
216 | + if ($this->containsType === 'list-equals') |
|
217 | 217 | { |
218 | 218 | return '\\\A'.$searchTerm.'\\\Z'; |
219 | 219 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | { |
230 | 230 | $tokens = explode('.', ltrim($this->variable->getFullName(), '$')); |
231 | 231 | |
232 | - if(count($tokens) === 2) |
|
232 | + if (count($tokens) === 2) |
|
233 | 233 | { |
234 | 234 | return array( |
235 | 235 | 'path' => $tokens[0], |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | $this->instantiator->checkCommand($cmd); |
35 | 35 | |
36 | - if($cmd instanceof Mailcode_Commands_Command_ShowVariable) |
|
36 | + if ($cmd instanceof Mailcode_Commands_Command_ShowVariable) |
|
37 | 37 | { |
38 | 38 | return $cmd; |
39 | 39 | } |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | throw $this->instantiator->exceptionUnexpectedType('ShowVariable', $cmd); |
42 | 42 | } |
43 | 43 | |
44 | - public function date(string $variableName, string $formatString="") : Mailcode_Commands_Command_ShowDate |
|
44 | + public function date(string $variableName, string $formatString = "") : Mailcode_Commands_Command_ShowDate |
|
45 | 45 | { |
46 | 46 | $variableName = $this->instantiator->filterVariableName($variableName); |
47 | 47 | |
48 | 48 | $format = ''; |
49 | - if(!empty($formatString)) |
|
49 | + if (!empty($formatString)) |
|
50 | 50 | { |
51 | 51 | $format = sprintf( |
52 | 52 | ' "%s"', |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | $this->instantiator->checkCommand($cmd); |
69 | 69 | |
70 | - if($cmd instanceof Mailcode_Commands_Command_ShowDate) |
|
70 | + if ($cmd instanceof Mailcode_Commands_Command_ShowDate) |
|
71 | 71 | { |
72 | 72 | return $cmd; |
73 | 73 | } |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | throw $this->instantiator->exceptionUnexpectedType('ShowDate', $cmd); |
76 | 76 | } |
77 | 77 | |
78 | - public function number(string $variableName, string $formatString="") : Mailcode_Commands_Command_ShowNumber |
|
78 | + public function number(string $variableName, string $formatString = "") : Mailcode_Commands_Command_ShowNumber |
|
79 | 79 | { |
80 | 80 | $variableName = $this->instantiator->filterVariableName($variableName); |
81 | 81 | |
82 | 82 | $format = ''; |
83 | - if(!empty($formatString)) |
|
83 | + if (!empty($formatString)) |
|
84 | 84 | { |
85 | 85 | $format = sprintf( |
86 | 86 | ' "%s"', |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | $this->instantiator->checkCommand($cmd); |
103 | 103 | |
104 | - if($cmd instanceof Mailcode_Commands_Command_ShowNumber) |
|
104 | + if ($cmd instanceof Mailcode_Commands_Command_ShowNumber) |
|
105 | 105 | { |
106 | 106 | return $cmd; |
107 | 107 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @throws Mailcode_Exception |
120 | 120 | * @throws Mailcode_Factory_Exception |
121 | 121 | */ |
122 | - public function phone(string $variableName, string $sourceFormat, string $urlEncoding=Mailcode_Factory::URL_ENCODING_NONE) : Mailcode_Commands_Command_ShowPhone |
|
122 | + public function phone(string $variableName, string $sourceFormat, string $urlEncoding = Mailcode_Factory::URL_ENCODING_NONE) : Mailcode_Commands_Command_ShowPhone |
|
123 | 123 | { |
124 | 124 | $variableName = $this->instantiator->filterVariableName($variableName); |
125 | 125 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $this->instantiator->checkCommand($cmd); |
143 | 143 | $this->instantiator->setEncoding($cmd, $urlEncoding); |
144 | 144 | |
145 | - if($cmd instanceof Mailcode_Commands_Command_ShowPhone) |
|
145 | + if ($cmd instanceof Mailcode_Commands_Command_ShowPhone) |
|
146 | 146 | { |
147 | 147 | return $cmd; |
148 | 148 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | $this->instantiator->checkCommand($cmd); |
165 | 165 | |
166 | - if($cmd instanceof Mailcode_Commands_Command_ShowSnippet) |
|
166 | + if ($cmd instanceof Mailcode_Commands_Command_ShowSnippet) |
|
167 | 167 | { |
168 | 168 | return $cmd; |
169 | 169 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | // All other special characters have to be escaped |
71 | 71 | // with two backslashes. |
72 | - foreach($this->regexSpecialChars as $char) |
|
72 | + foreach ($this->regexSpecialChars as $char) |
|
73 | 73 | { |
74 | 74 | $string = str_replace($char, '\\'.$char, $string); |
75 | 75 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | protected function addURLEncoding(Mailcode_Commands_Command $command, string $statement) : string |
85 | 85 | { |
86 | - if($command->isURLEncoded()) |
|
86 | + if ($command->isURLEncoded()) |
|
87 | 87 | { |
88 | 88 | return sprintf( |
89 | 89 | '${esc.url($%s)}', |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | ); |
92 | 92 | } |
93 | 93 | |
94 | - if($command->isURLDecoded()) |
|
94 | + if ($command->isURLDecoded()) |
|
95 | 95 | { |
96 | 96 | return sprintf( |
97 | 97 | '${esc.unurl($%s)}', |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $varName = ltrim($command->getVariableName(), '$'); |
57 | 57 | $javaFormat = $this->translateFormat($command->getFormatString()); |
58 | 58 | |
59 | - if(empty($internalFormat)) |
|
59 | + if (empty($internalFormat)) |
|
60 | 60 | { |
61 | 61 | $internalFormat = self::DEFAULT_INTERNAL_FORMAT; |
62 | 62 | } |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | $chars = ConvertHelper::string2array($formatString); |
77 | 77 | $result = array(); |
78 | 78 | |
79 | - foreach($chars as $char) |
|
79 | + foreach ($chars as $char) |
|
80 | 80 | { |
81 | - if(!isset($this->charTable[$char])) |
|
81 | + if (!isset($this->charTable[$char])) |
|
82 | 82 | { |
83 | 83 | throw new Mailcode_Translator_Exception( |
84 | 84 | 'Unknown date format string character', |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | declare(strict_types=1); |
4 | 4 | |
5 | -if(!file_exists('../vendor/autoload.php')) { |
|
5 | +if (!file_exists('../vendor/autoload.php')) { |
|
6 | 6 | die('Autoloader not present.'); |
7 | 7 | } |
8 | 8 |