@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | { |
25 | 25 | const ERROR_CANNOT_RETRIEVE_FIRST_ERROR = 52301; |
26 | 26 | |
27 | - /** |
|
28 | - * @var Mailcode_Commands_Command[] |
|
29 | - */ |
|
27 | + /** |
|
28 | + * @var Mailcode_Commands_Command[] |
|
29 | + */ |
|
30 | 30 | protected $commands = array(); |
31 | 31 | |
32 | 32 | /** |
@@ -34,17 +34,17 @@ discard block |
||
34 | 34 | */ |
35 | 35 | protected $errors = array(); |
36 | 36 | |
37 | - /** |
|
38 | - * @var OperationResult|NULL |
|
39 | - */ |
|
37 | + /** |
|
38 | + * @var OperationResult|NULL |
|
39 | + */ |
|
40 | 40 | protected $validationResult; |
41 | 41 | |
42 | - /** |
|
43 | - * Adds a command to the collection. |
|
44 | - * |
|
45 | - * @param Mailcode_Commands_Command $command |
|
46 | - * @return Mailcode_Collection |
|
47 | - */ |
|
42 | + /** |
|
43 | + * Adds a command to the collection. |
|
44 | + * |
|
45 | + * @param Mailcode_Commands_Command $command |
|
46 | + * @return Mailcode_Collection |
|
47 | + */ |
|
48 | 48 | public function addCommand(Mailcode_Commands_Command $command) : Mailcode_Collection |
49 | 49 | { |
50 | 50 | $this->commands[] = $command; |
@@ -56,21 +56,21 @@ discard block |
||
56 | 56 | return $this; |
57 | 57 | } |
58 | 58 | |
59 | - /** |
|
60 | - * Whether there are any commands in the collection. |
|
61 | - * |
|
62 | - * @return bool |
|
63 | - */ |
|
59 | + /** |
|
60 | + * Whether there are any commands in the collection. |
|
61 | + * |
|
62 | + * @return bool |
|
63 | + */ |
|
64 | 64 | public function hasCommands() : bool |
65 | 65 | { |
66 | 66 | return !empty($this->commands); |
67 | 67 | } |
68 | 68 | |
69 | - /** |
|
70 | - * Counts the amount of commands in the collection. |
|
71 | - * |
|
72 | - * @return int |
|
73 | - */ |
|
69 | + /** |
|
70 | + * Counts the amount of commands in the collection. |
|
71 | + * |
|
72 | + * @return int |
|
73 | + */ |
|
74 | 74 | public function countCommands() : int |
75 | 75 | { |
76 | 76 | return count($this->commands); |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | $this->errors[] = new Mailcode_Collection_Error_Command($command); |
91 | 91 | } |
92 | 92 | |
93 | - /** |
|
94 | - * @return Mailcode_Collection_Error[] |
|
95 | - */ |
|
93 | + /** |
|
94 | + * @return Mailcode_Collection_Error[] |
|
95 | + */ |
|
96 | 96 | public function getErrors() |
97 | 97 | { |
98 | 98 | $result = $this->getValidationResult(); |
@@ -134,25 +134,25 @@ discard block |
||
134 | 134 | return empty($errors); |
135 | 135 | } |
136 | 136 | |
137 | - /** |
|
138 | - * Retrieves all commands that were detected, in the exact order |
|
139 | - * they were found. |
|
140 | - * |
|
141 | - * @return \Mailcode\Mailcode_Commands_Command[] |
|
142 | - */ |
|
137 | + /** |
|
138 | + * Retrieves all commands that were detected, in the exact order |
|
139 | + * they were found. |
|
140 | + * |
|
141 | + * @return \Mailcode\Mailcode_Commands_Command[] |
|
142 | + */ |
|
143 | 143 | public function getCommands() |
144 | 144 | { |
145 | - return $this->commands; |
|
145 | + return $this->commands; |
|
146 | 146 | } |
147 | 147 | |
148 | - /** |
|
149 | - * Retrieves all unique commands by their matched |
|
150 | - * string hash: this ensures only commands that were |
|
151 | - * written the exact same way (including spacing) |
|
152 | - * are returned. |
|
153 | - * |
|
154 | - * @return \Mailcode\Mailcode_Commands_Command[] |
|
155 | - */ |
|
148 | + /** |
|
149 | + * Retrieves all unique commands by their matched |
|
150 | + * string hash: this ensures only commands that were |
|
151 | + * written the exact same way (including spacing) |
|
152 | + * are returned. |
|
153 | + * |
|
154 | + * @return \Mailcode\Mailcode_Commands_Command[] |
|
155 | + */ |
|
156 | 156 | public function getGroupedByHash() |
157 | 157 | { |
158 | 158 | $hashes = array(); |
@@ -170,12 +170,12 @@ discard block |
||
170 | 170 | return array_values($hashes); |
171 | 171 | } |
172 | 172 | |
173 | - /** |
|
174 | - * Adds several commands at once. |
|
175 | - * |
|
176 | - * @param Mailcode_Commands_Command[] $commands |
|
177 | - * @return Mailcode_Collection |
|
178 | - */ |
|
173 | + /** |
|
174 | + * Adds several commands at once. |
|
175 | + * |
|
176 | + * @param Mailcode_Commands_Command[] $commands |
|
177 | + * @return Mailcode_Collection |
|
178 | + */ |
|
179 | 179 | public function addCommands(array $commands) : Mailcode_Collection |
180 | 180 | { |
181 | 181 | foreach($commands as $command) |
@@ -234,21 +234,21 @@ discard block |
||
234 | 234 | return false; |
235 | 235 | } |
236 | 236 | |
237 | - /** |
|
238 | - * Retrieves only show variable commands in the collection, if any. |
|
239 | - * |
|
240 | - * @return Mailcode_Commands_Command_ShowVariable[] |
|
241 | - */ |
|
237 | + /** |
|
238 | + * Retrieves only show variable commands in the collection, if any. |
|
239 | + * |
|
240 | + * @return Mailcode_Commands_Command_ShowVariable[] |
|
241 | + */ |
|
242 | 242 | public function getShowVariableCommands() |
243 | 243 | { |
244 | 244 | return $this->getCommandsByClass(Mailcode_Commands_Command_ShowVariable::class); |
245 | 245 | } |
246 | 246 | |
247 | - /** |
|
248 | - * Retrieves only show date commands in the collection, if any. |
|
249 | - * |
|
250 | - * @return Mailcode_Commands_Command_ShowDate[] |
|
251 | - */ |
|
247 | + /** |
|
248 | + * Retrieves only show date commands in the collection, if any. |
|
249 | + * |
|
250 | + * @return Mailcode_Commands_Command_ShowDate[] |
|
251 | + */ |
|
252 | 252 | public function getShowDateCommands() : array |
253 | 253 | { |
254 | 254 | return $this->getCommandsByClass(Mailcode_Commands_Command_ShowDate::class); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | $errors = $this->errors; |
101 | 101 | |
102 | - if(!$result->isValid()) |
|
102 | + if (!$result->isValid()) |
|
103 | 103 | { |
104 | 104 | $errors[] = new Mailcode_Collection_Error_Message( |
105 | 105 | '', |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | { |
116 | 116 | $errors = $this->getErrors(); |
117 | 117 | |
118 | - if(!empty($errors)) |
|
118 | + if (!empty($errors)) |
|
119 | 119 | { |
120 | 120 | return array_shift($errors); |
121 | 121 | } |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | { |
158 | 158 | $hashes = array(); |
159 | 159 | |
160 | - foreach($this->commands as $command) |
|
160 | + foreach ($this->commands as $command) |
|
161 | 161 | { |
162 | 162 | $hash = $command->getHash(); |
163 | 163 | |
164 | - if(!isset($hashes[$hash])) |
|
164 | + if (!isset($hashes[$hash])) |
|
165 | 165 | { |
166 | 166 | $hashes[$hash] = $command; |
167 | 167 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function addCommands(array $commands) : Mailcode_Collection |
180 | 180 | { |
181 | - foreach($commands as $command) |
|
181 | + foreach ($commands as $command) |
|
182 | 182 | { |
183 | 183 | $this->addCommand($command); |
184 | 184 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | { |
198 | 198 | $collection = new Mailcode_Variables_Collection_Regular(); |
199 | 199 | |
200 | - foreach($this->commands as $command) |
|
200 | + foreach ($this->commands as $command) |
|
201 | 201 | { |
202 | 202 | $collection->mergeWith($command->getVariables()); |
203 | 203 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | |
208 | 208 | public function getValidationResult() : OperationResult |
209 | 209 | { |
210 | - if($this->validationResult instanceof OperationResult) |
|
210 | + if ($this->validationResult instanceof OperationResult) |
|
211 | 211 | { |
212 | 212 | return $this->validationResult; |
213 | 213 | } |
@@ -223,9 +223,9 @@ discard block |
||
223 | 223 | { |
224 | 224 | $errors = $this->getErrors(); |
225 | 225 | |
226 | - foreach($errors as $error) |
|
226 | + foreach ($errors as $error) |
|
227 | 227 | { |
228 | - if($error->getCode() === $code) |
|
228 | + if ($error->getCode() === $code) |
|
229 | 229 | { |
230 | 230 | return true; |
231 | 231 | } |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | { |
263 | 263 | $result = array(); |
264 | 264 | |
265 | - foreach($this->commands as $command) |
|
265 | + foreach ($this->commands as $command) |
|
266 | 266 | { |
267 | - if($command instanceof $className) |
|
267 | + if ($command instanceof $className) |
|
268 | 268 | { |
269 | 269 | $result[] = $command; |
270 | 270 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | { |
278 | 278 | $commands = $this->getCommands(); |
279 | 279 | |
280 | - if(!empty($commands)) |
|
280 | + if (!empty($commands)) |
|
281 | 281 | { |
282 | 282 | return array_shift($commands); |
283 | 283 | } |
@@ -32,44 +32,44 @@ discard block |
||
32 | 32 | const VALIDATION_UNKNOWN_COMMAND_NAME = 48304; |
33 | 33 | const VALIDATION_INVALID_PARAMS_STATEMENT = 48305; |
34 | 34 | |
35 | - /** |
|
36 | - * @var string |
|
37 | - */ |
|
35 | + /** |
|
36 | + * @var string |
|
37 | + */ |
|
38 | 38 | protected $type = ''; |
39 | 39 | |
40 | - /** |
|
41 | - * @var string |
|
42 | - */ |
|
40 | + /** |
|
41 | + * @var string |
|
42 | + */ |
|
43 | 43 | protected $paramsString = ''; |
44 | 44 | |
45 | - /** |
|
46 | - * @var string |
|
47 | - */ |
|
45 | + /** |
|
46 | + * @var string |
|
47 | + */ |
|
48 | 48 | protected $matchedText = ''; |
49 | 49 | |
50 | - /** |
|
51 | - * @var string |
|
52 | - */ |
|
50 | + /** |
|
51 | + * @var string |
|
52 | + */ |
|
53 | 53 | protected $hash = ''; |
54 | 54 | |
55 | - /** |
|
56 | - * @var \AppUtils\OperationResult |
|
57 | - */ |
|
55 | + /** |
|
56 | + * @var \AppUtils\OperationResult |
|
57 | + */ |
|
58 | 58 | protected $validationResult = null; |
59 | 59 | |
60 | - /** |
|
61 | - * @var \Mailcode\Mailcode |
|
62 | - */ |
|
60 | + /** |
|
61 | + * @var \Mailcode\Mailcode |
|
62 | + */ |
|
63 | 63 | protected $mailcode; |
64 | 64 | |
65 | - /** |
|
66 | - * @var \Mailcode\Mailcode_Parser_Statement |
|
67 | - */ |
|
65 | + /** |
|
66 | + * @var \Mailcode\Mailcode_Parser_Statement |
|
67 | + */ |
|
68 | 68 | protected $params; |
69 | 69 | |
70 | - /** |
|
71 | - * @var string[] |
|
72 | - */ |
|
70 | + /** |
|
71 | + * @var string[] |
|
72 | + */ |
|
73 | 73 | protected $validations = array( |
74 | 74 | 'params_empty', |
75 | 75 | 'params_keywords', |
@@ -78,24 +78,24 @@ discard block |
||
78 | 78 | 'type_unsupported' |
79 | 79 | ); |
80 | 80 | |
81 | - /** |
|
82 | - * @var string |
|
83 | - */ |
|
81 | + /** |
|
82 | + * @var string |
|
83 | + */ |
|
84 | 84 | protected $comment = ''; |
85 | 85 | |
86 | - /** |
|
87 | - * @var Mailcode_Commands_LogicKeywords|NULL |
|
88 | - */ |
|
86 | + /** |
|
87 | + * @var Mailcode_Commands_LogicKeywords|NULL |
|
88 | + */ |
|
89 | 89 | protected $logicKeywords; |
90 | 90 | |
91 | - /** |
|
92 | - * @var Mailcode_Parser_Statement_Validator |
|
93 | - */ |
|
91 | + /** |
|
92 | + * @var Mailcode_Parser_Statement_Validator |
|
93 | + */ |
|
94 | 94 | protected $validator; |
95 | 95 | |
96 | - /** |
|
97 | - * @var boolean |
|
98 | - */ |
|
96 | + /** |
|
97 | + * @var boolean |
|
98 | + */ |
|
99 | 99 | private $validated = false; |
100 | 100 | |
101 | 101 | /** |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | |
121 | 121 | } |
122 | 122 | |
123 | - /** |
|
124 | - * @return string The ID of the command = the name of the command class file. |
|
125 | - */ |
|
123 | + /** |
|
124 | + * @return string The ID of the command = the name of the command class file. |
|
125 | + */ |
|
126 | 126 | public function getID() : string |
127 | 127 | { |
128 | 128 | // account for commands with types: If_Variable should still return If. |
@@ -131,14 +131,14 @@ discard block |
||
131 | 131 | return array_shift($tokens); |
132 | 132 | } |
133 | 133 | |
134 | - /** |
|
135 | - * Sets an optional comment that is not used anywhere, but |
|
136 | - * can be used by the application to track why a command is |
|
137 | - * used somewhere. |
|
138 | - * |
|
139 | - * @param string $comment |
|
140 | - * @return Mailcode_Commands_Command |
|
141 | - */ |
|
134 | + /** |
|
135 | + * Sets an optional comment that is not used anywhere, but |
|
136 | + * can be used by the application to track why a command is |
|
137 | + * used somewhere. |
|
138 | + * |
|
139 | + * @param string $comment |
|
140 | + * @return Mailcode_Commands_Command |
|
141 | + */ |
|
142 | 142 | public function setComment(string $comment) : Mailcode_Commands_Command |
143 | 143 | { |
144 | 144 | $this->comment = $comment; |
@@ -146,34 +146,34 @@ discard block |
||
146 | 146 | return $this; |
147 | 147 | } |
148 | 148 | |
149 | - /** |
|
150 | - * Retrieves the previously set comment, if any. |
|
151 | - * |
|
152 | - * @return string |
|
153 | - */ |
|
149 | + /** |
|
150 | + * Retrieves the previously set comment, if any. |
|
151 | + * |
|
152 | + * @return string |
|
153 | + */ |
|
154 | 154 | public function getComment() : string |
155 | 155 | { |
156 | 156 | return $this->comment; |
157 | 157 | } |
158 | 158 | |
159 | - /** |
|
160 | - * Checks whether this is a dummy command, which is only |
|
161 | - * used to access information on the command type. It cannot |
|
162 | - * be used as an actual live command. |
|
163 | - * |
|
164 | - * @return bool |
|
165 | - */ |
|
159 | + /** |
|
160 | + * Checks whether this is a dummy command, which is only |
|
161 | + * used to access information on the command type. It cannot |
|
162 | + * be used as an actual live command. |
|
163 | + * |
|
164 | + * @return bool |
|
165 | + */ |
|
166 | 166 | public function isDummy() : bool |
167 | 167 | { |
168 | 168 | return $this->type === '__dummy'; |
169 | 169 | } |
170 | 170 | |
171 | - /** |
|
172 | - * Retrieves a hash of the actual matched command string, |
|
173 | - * which is used in collections to detect duplicate commands. |
|
174 | - * |
|
175 | - * @return string |
|
176 | - */ |
|
171 | + /** |
|
172 | + * Retrieves a hash of the actual matched command string, |
|
173 | + * which is used in collections to detect duplicate commands. |
|
174 | + * |
|
175 | + * @return string |
|
176 | + */ |
|
177 | 177 | public function getHash() : string |
178 | 178 | { |
179 | 179 | $this->requireNonDummy(); |
@@ -267,9 +267,9 @@ discard block |
||
267 | 267 | return $this->validationResult->isValid(); |
268 | 268 | } |
269 | 269 | |
270 | - /** |
|
271 | - * @return string[] |
|
272 | - */ |
|
270 | + /** |
|
271 | + * @return string[] |
|
272 | + */ |
|
273 | 273 | abstract protected function getValidations() : array; |
274 | 274 | |
275 | 275 | protected function validateSyntax_params_empty() : void |
@@ -428,12 +428,12 @@ discard block |
||
428 | 428 | |
429 | 429 | abstract public function supportsType() : bool; |
430 | 430 | |
431 | - /** |
|
432 | - * Whether the command allows using logic keywords like "and:" or "or:" |
|
433 | - * in the command parameters. |
|
434 | - * |
|
435 | - * @return bool |
|
436 | - */ |
|
431 | + /** |
|
432 | + * Whether the command allows using logic keywords like "and:" or "or:" |
|
433 | + * in the command parameters. |
|
434 | + * |
|
435 | + * @return bool |
|
436 | + */ |
|
437 | 437 | abstract public function supportsLogicKeywords() : bool; |
438 | 438 | |
439 | 439 | abstract public function generatesContent() : bool; |
@@ -479,22 +479,22 @@ discard block |
||
479 | 479 | return $normalizer->normalize(); |
480 | 480 | } |
481 | 481 | |
482 | - /** |
|
483 | - * Retrieves the names of all the command's supported types: the part |
|
484 | - * between the command name and the colon. Example: {command type: params}. |
|
485 | - * |
|
486 | - * @return string[] |
|
487 | - */ |
|
482 | + /** |
|
483 | + * Retrieves the names of all the command's supported types: the part |
|
484 | + * between the command name and the colon. Example: {command type: params}. |
|
485 | + * |
|
486 | + * @return string[] |
|
487 | + */ |
|
488 | 488 | public function getSupportedTypes() : array |
489 | 489 | { |
490 | 490 | return array(); |
491 | 491 | } |
492 | 492 | |
493 | - /** |
|
494 | - * Retrieves all variable names used in the command. |
|
495 | - * |
|
496 | - * @return Mailcode_Variables_Collection_Regular |
|
497 | - */ |
|
493 | + /** |
|
494 | + * Retrieves all variable names used in the command. |
|
495 | + * |
|
496 | + * @return Mailcode_Variables_Collection_Regular |
|
497 | + */ |
|
498 | 498 | public function getVariables() : Mailcode_Variables_Collection_Regular |
499 | 499 | { |
500 | 500 | return Mailcode::create()->findVariables($this->paramsString); |
@@ -519,26 +519,26 @@ discard block |
||
519 | 519 | ); |
520 | 520 | } |
521 | 521 | |
522 | - /** |
|
523 | - * Sets a parameter for the translation backend. The backend can use |
|
524 | - * these to allow command-specific configurations. |
|
525 | - * |
|
526 | - * @param string $name |
|
527 | - * @param mixed $value |
|
528 | - * @return $this |
|
529 | - */ |
|
522 | + /** |
|
523 | + * Sets a parameter for the translation backend. The backend can use |
|
524 | + * these to allow command-specific configurations. |
|
525 | + * |
|
526 | + * @param string $name |
|
527 | + * @param mixed $value |
|
528 | + * @return $this |
|
529 | + */ |
|
530 | 530 | public function setTranslationParam(string $name, $value) |
531 | 531 | { |
532 | 532 | $this->translationParams[$name] = $value; |
533 | 533 | return $this; |
534 | 534 | } |
535 | 535 | |
536 | - /** |
|
537 | - * Retrieves a previously set translation parameter. |
|
538 | - * |
|
539 | - * @param string $name |
|
540 | - * @return mixed |
|
541 | - */ |
|
536 | + /** |
|
537 | + * Retrieves a previously set translation parameter. |
|
538 | + * |
|
539 | + * @param string $name |
|
540 | + * @return mixed |
|
541 | + */ |
|
542 | 542 | public function getTranslationParam(string $name) |
543 | 543 | { |
544 | 544 | if(isset($this->translationParams[$name])) |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | protected $translationParams = array(); |
106 | 106 | |
107 | - public function __construct(string $type='', string $paramsString='', string $matchedText='') |
|
107 | + public function __construct(string $type = '', string $paramsString = '', string $matchedText = '') |
|
108 | 108 | { |
109 | 109 | $this->type = $type; |
110 | 110 | $this->paramsString = html_entity_decode($paramsString); |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | { |
179 | 179 | $this->requireNonDummy(); |
180 | 180 | |
181 | - if($this->hash === '') { |
|
181 | + if ($this->hash === '') { |
|
182 | 182 | $this->hash = md5($this->matchedText); |
183 | 183 | } |
184 | 184 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | protected function requireNonDummy() : void |
189 | 189 | { |
190 | - if(!$this->isDummy()) |
|
190 | + if (!$this->isDummy()) |
|
191 | 191 | { |
192 | 192 | return; |
193 | 193 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | |
207 | 207 | protected function validate() : \AppUtils\OperationResult |
208 | 208 | { |
209 | - if(!$this->validated) |
|
209 | + if (!$this->validated) |
|
210 | 210 | { |
211 | 211 | $this->requireNonDummy(); |
212 | 212 | $this->validateSyntax(); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | |
220 | 220 | public function getValidationResult() : \AppUtils\OperationResult |
221 | 221 | { |
222 | - if(isset($this->validationResult)) |
|
222 | + if (isset($this->validationResult)) |
|
223 | 223 | { |
224 | 224 | return $this->validationResult; |
225 | 225 | } |
@@ -235,10 +235,10 @@ discard block |
||
235 | 235 | { |
236 | 236 | $validations = array_merge($this->validations, $this->getValidations()); |
237 | 237 | |
238 | - foreach($validations as $validation) |
|
238 | + foreach ($validations as $validation) |
|
239 | 239 | { |
240 | 240 | // break off at the first validation issue |
241 | - if(!$this->validateSyntaxMethod($validation)) |
|
241 | + if (!$this->validateSyntaxMethod($validation)) |
|
242 | 242 | { |
243 | 243 | return; |
244 | 244 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | { |
250 | 250 | $method = 'validateSyntax_'.$validation; |
251 | 251 | |
252 | - if(!method_exists($this, $method)) |
|
252 | + if (!method_exists($this, $method)) |
|
253 | 253 | { |
254 | 254 | throw new Mailcode_Exception( |
255 | 255 | 'Missing validation method ['.$validation.']', |
@@ -274,12 +274,12 @@ discard block |
||
274 | 274 | |
275 | 275 | protected function validateSyntax_params_empty() : void |
276 | 276 | { |
277 | - if(!$this->requiresParameters()) |
|
277 | + if (!$this->requiresParameters()) |
|
278 | 278 | { |
279 | 279 | return; |
280 | 280 | } |
281 | 281 | |
282 | - if(empty($this->paramsString)) |
|
282 | + if (empty($this->paramsString)) |
|
283 | 283 | { |
284 | 284 | $this->validationResult->makeError( |
285 | 285 | t('Parameters have to be specified.'), |
@@ -291,14 +291,14 @@ discard block |
||
291 | 291 | |
292 | 292 | protected function validateSyntax_params_keywords() : void |
293 | 293 | { |
294 | - if(!$this->supportsLogicKeywords()) |
|
294 | + if (!$this->supportsLogicKeywords()) |
|
295 | 295 | { |
296 | 296 | return; |
297 | 297 | } |
298 | 298 | |
299 | 299 | $this->logicKeywords = new Mailcode_Commands_LogicKeywords($this, $this->paramsString); |
300 | 300 | |
301 | - if(!$this->logicKeywords->isValid()) |
|
301 | + if (!$this->logicKeywords->isValid()) |
|
302 | 302 | { |
303 | 303 | $this->validationResult->makeError( |
304 | 304 | t('Invalid parameters:').' '.$this->logicKeywords->getErrorMessage(), |
@@ -313,14 +313,14 @@ discard block |
||
313 | 313 | |
314 | 314 | protected function validateSyntax_params_parse() : void |
315 | 315 | { |
316 | - if(!$this->requiresParameters()) |
|
316 | + if (!$this->requiresParameters()) |
|
317 | 317 | { |
318 | 318 | return; |
319 | 319 | } |
320 | 320 | |
321 | 321 | $this->params = $this->mailcode->getParser()->createStatement($this->paramsString); |
322 | 322 | |
323 | - if(!$this->params->isValid()) |
|
323 | + if (!$this->params->isValid()) |
|
324 | 324 | { |
325 | 325 | $error = $this->params->getValidationResult(); |
326 | 326 | |
@@ -337,14 +337,14 @@ discard block |
||
337 | 337 | |
338 | 338 | protected function validateSyntax_type_supported() : void |
339 | 339 | { |
340 | - if(!$this->supportsType() || empty($this->type)) |
|
340 | + if (!$this->supportsType() || empty($this->type)) |
|
341 | 341 | { |
342 | 342 | return; |
343 | 343 | } |
344 | 344 | |
345 | 345 | $types = $this->getSupportedTypes(); |
346 | 346 | |
347 | - if(!in_array($this->type, $types)) |
|
347 | + if (!in_array($this->type, $types)) |
|
348 | 348 | { |
349 | 349 | $this->validationResult->makeError( |
350 | 350 | t('The command addon %1$s is not supported.', $this->type).' '. |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | |
359 | 359 | protected function validateSyntax_type_unsupported() : void |
360 | 360 | { |
361 | - if($this->supportsType() || empty($this->type)) |
|
361 | + if ($this->supportsType() || empty($this->type)) |
|
362 | 362 | { |
363 | 363 | return; |
364 | 364 | } |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | |
377 | 377 | public function getType() : string |
378 | 378 | { |
379 | - if($this->supportsType()) |
|
379 | + if ($this->supportsType()) |
|
380 | 380 | { |
381 | 381 | return $this->type; |
382 | 382 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | |
397 | 397 | public function getHighlighted() : string |
398 | 398 | { |
399 | - if(!$this->isValid()) |
|
399 | + if (!$this->isValid()) |
|
400 | 400 | { |
401 | 401 | return ''; |
402 | 402 | } |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | |
408 | 408 | public function getParamsString() : string |
409 | 409 | { |
410 | - if($this->requiresParameters()) |
|
410 | + if ($this->requiresParameters()) |
|
411 | 411 | { |
412 | 412 | return $this->paramsString; |
413 | 413 | } |
@@ -442,22 +442,22 @@ discard block |
||
442 | 442 | |
443 | 443 | public final function getCommandType() : string |
444 | 444 | { |
445 | - if($this instanceof Mailcode_Commands_Command_Type_Closing) |
|
445 | + if ($this instanceof Mailcode_Commands_Command_Type_Closing) |
|
446 | 446 | { |
447 | 447 | return 'Closing'; |
448 | 448 | } |
449 | 449 | |
450 | - if($this instanceof Mailcode_Commands_Command_Type_Opening) |
|
450 | + if ($this instanceof Mailcode_Commands_Command_Type_Opening) |
|
451 | 451 | { |
452 | 452 | return 'Opening'; |
453 | 453 | } |
454 | 454 | |
455 | - if($this instanceof Mailcode_Commands_Command_Type_Sibling) |
|
455 | + if ($this instanceof Mailcode_Commands_Command_Type_Sibling) |
|
456 | 456 | { |
457 | 457 | return 'Sibling'; |
458 | 458 | } |
459 | 459 | |
460 | - if($this instanceof Mailcode_Commands_Command_Type_Standalone) |
|
460 | + if ($this instanceof Mailcode_Commands_Command_Type_Standalone) |
|
461 | 461 | { |
462 | 462 | return 'Standalone'; |
463 | 463 | } |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | |
508 | 508 | public function getLogicKeywords() : Mailcode_Commands_LogicKeywords |
509 | 509 | { |
510 | - if($this->supportsLogicKeywords() && isset($this->logicKeywords)) |
|
510 | + if ($this->supportsLogicKeywords() && isset($this->logicKeywords)) |
|
511 | 511 | { |
512 | 512 | return $this->logicKeywords; |
513 | 513 | } |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | */ |
542 | 542 | public function getTranslationParam(string $name) |
543 | 543 | { |
544 | - if(isset($this->translationParams[$name])) |
|
544 | + if (isset($this->translationParams[$name])) |
|
545 | 545 | { |
546 | 546 | return $this->translationParams[$name]; |
547 | 547 | } |
@@ -24,15 +24,15 @@ |
||
24 | 24 | { |
25 | 25 | const ERROR_UNKNOWN_DATE_FORMAT_CHARACTER = 55501; |
26 | 26 | |
27 | - /** |
|
28 | - * The date format used in the date variable. This is used to convert |
|
29 | - * the native date to the format specified in the variable command. |
|
30 | - */ |
|
27 | + /** |
|
28 | + * The date format used in the date variable. This is used to convert |
|
29 | + * the native date to the format specified in the variable command. |
|
30 | + */ |
|
31 | 31 | const DEFAULT_INTERNAL_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"; |
32 | 32 | |
33 | - /** |
|
34 | - * @var string[]string |
|
35 | - */ |
|
33 | + /** |
|
34 | + * @var string[]string |
|
35 | + */ |
|
36 | 36 | private $charTable = array( |
37 | 37 | 'd' => 'd', |
38 | 38 | 'm' => 'M', |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | { |
53 | 53 | $internalFormat = $command->getTranslationParam('internal_format'); |
54 | 54 | |
55 | - if(empty($internalFormat)) |
|
55 | + if (empty($internalFormat)) |
|
56 | 56 | { |
57 | 57 | $internalFormat = self::DEFAULT_INTERNAL_FORMAT; |
58 | 58 | } |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | $chars = ConvertHelper::string2array($formatString); |
71 | 71 | $result = array(); |
72 | 72 | |
73 | - foreach($chars as $char) |
|
73 | + foreach ($chars as $char) |
|
74 | 74 | { |
75 | - if(!isset($this->charTable[$char])) |
|
75 | + if (!isset($this->charTable[$char])) |
|
76 | 76 | { |
77 | 77 | throw new Mailcode_Translator_Exception( |
78 | 78 | 'Unknown date format string character', |