| @@ -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 | } | 
| @@ -20,9 +20,9 @@ | ||
| 20 | 20 | */ | 
| 21 | 21 | abstract class Mailcode_Factory_CommandSets_Set | 
| 22 | 22 |  { | 
| 23 | - /** | |
| 24 | - * @var Mailcode_Factory_Instantiator | |
| 25 | - */ | |
| 23 | + /** | |
| 24 | + * @var Mailcode_Factory_Instantiator | |
| 25 | + */ | |
| 26 | 26 | protected $instantiator; | 
| 27 | 27 | |
| 28 | 28 | /** | 
| @@ -54,45 +54,45 @@ discard block | ||
| 54 | 54 | const ERROR_INVALID_COMMANDS = 47801; | 
| 55 | 55 | const ERROR_PLACEHOLDER_NOT_FOUND = 47804; | 
| 56 | 56 | |
| 57 | - /** | |
| 58 | - * @var Mailcode_Parser | |
| 59 | - */ | |
| 57 | + /** | |
| 58 | + * @var Mailcode_Parser | |
| 59 | + */ | |
| 60 | 60 | protected $parser; | 
| 61 | 61 | |
| 62 | - /** | |
| 63 | - * @var Mailcode_Collection | |
| 64 | - */ | |
| 62 | + /** | |
| 63 | + * @var Mailcode_Collection | |
| 64 | + */ | |
| 65 | 65 | protected $commands; | 
| 66 | 66 | |
| 67 | - /** | |
| 68 | - * @var string | |
| 69 | - */ | |
| 67 | + /** | |
| 68 | + * @var string | |
| 69 | + */ | |
| 70 | 70 | protected $originalString; | 
| 71 | 71 | |
| 72 | - /** | |
| 73 | - * @var Mailcode_Collection | |
| 74 | - */ | |
| 72 | + /** | |
| 73 | + * @var Mailcode_Collection | |
| 74 | + */ | |
| 75 | 75 | protected $collection; | 
| 76 | 76 | |
| 77 | - /** | |
| 78 | - * Counter for the placeholders, global for all placeholders. | |
| 79 | - * @var integer | |
| 80 | - */ | |
| 77 | + /** | |
| 78 | + * Counter for the placeholders, global for all placeholders. | |
| 79 | + * @var integer | |
| 80 | + */ | |
| 81 | 81 | private static $counter = 0; | 
| 82 | 82 | |
| 83 | - /** | |
| 84 | - * @var Mailcode_Parser_Safeguard_Placeholder[] | |
| 85 | - */ | |
| 83 | + /** | |
| 84 | + * @var Mailcode_Parser_Safeguard_Placeholder[] | |
| 85 | + */ | |
| 86 | 86 | protected $placeholders; | 
| 87 | 87 | |
| 88 | - /** | |
| 89 | - * @var string | |
| 90 | - */ | |
| 88 | + /** | |
| 89 | + * @var string | |
| 90 | + */ | |
| 91 | 91 | protected $delimiter = '999'; | 
| 92 | 92 | |
| 93 | - /** | |
| 94 | - * @var string[]|NULL | |
| 95 | - */ | |
| 93 | + /** | |
| 94 | + * @var string[]|NULL | |
| 95 | + */ | |
| 96 | 96 | protected $placeholderStrings; | 
| 97 | 97 | |
| 98 | 98 | public function __construct(Mailcode_Parser $parser, string $subject) | 
| @@ -111,28 +111,28 @@ discard block | ||
| 111 | 111 | self::$counter = 0; | 
| 112 | 112 | } | 
| 113 | 113 | |
| 114 | - /** | |
| 115 | - * Retrieves the string the safeguard was created for. | |
| 116 | - * | |
| 117 | - * @return string | |
| 118 | - */ | |
| 114 | + /** | |
| 115 | + * Retrieves the string the safeguard was created for. | |
| 116 | + * | |
| 117 | + * @return string | |
| 118 | + */ | |
| 119 | 119 | public function getOriginalString() : string | 
| 120 | 120 |      { | 
| 121 | 121 | return $this->originalString; | 
| 122 | 122 | } | 
| 123 | 123 | |
| 124 | - /** | |
| 125 | - * Sets the delimiter character sequence used to prepend | |
| 126 | - * and append to the placeholders. | |
| 127 | - * | |
| 128 | - * The delimiter's default is "999". | |
| 129 | - * | |
| 130 | - * Minimum characters: 2 | |
| 131 | - * Invalid characters: Any characters that get URL encoded | |
| 132 | - * | |
| 133 | - * @param string $delimiter | |
| 134 | - * @return Mailcode_Parser_Safeguard | |
| 135 | - */ | |
| 124 | + /** | |
| 125 | + * Sets the delimiter character sequence used to prepend | |
| 126 | + * and append to the placeholders. | |
| 127 | + * | |
| 128 | + * The delimiter's default is "999". | |
| 129 | + * | |
| 130 | + * Minimum characters: 2 | |
| 131 | + * Invalid characters: Any characters that get URL encoded | |
| 132 | + * | |
| 133 | + * @param string $delimiter | |
| 134 | + * @return Mailcode_Parser_Safeguard | |
| 135 | + */ | |
| 136 | 136 | public function setDelimiter(string $delimiter) : Mailcode_Parser_Safeguard | 
| 137 | 137 |      { | 
| 138 | 138 | $validator = new Mailcode_Parser_Safeguard_DelimiterValidator($delimiter); | 
| @@ -148,15 +148,15 @@ discard block | ||
| 148 | 148 | return $this->delimiter; | 
| 149 | 149 | } | 
| 150 | 150 | |
| 151 | - /** | |
| 152 | - * Retrieves the safe string in which all commands have been replaced | |
| 153 | - * by placeholder strings. | |
| 154 | - * | |
| 155 | - * @return string | |
| 156 | - * @throws Mailcode_Exception | |
| 157 | - * | |
| 158 | - * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS | |
| 159 | - */ | |
| 151 | + /** | |
| 152 | + * Retrieves the safe string in which all commands have been replaced | |
| 153 | + * by placeholder strings. | |
| 154 | + * | |
| 155 | + * @return string | |
| 156 | + * @throws Mailcode_Exception | |
| 157 | + * | |
| 158 | + * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS | |
| 159 | + */ | |
| 160 | 160 | public function makeSafe() : string | 
| 161 | 161 |      { | 
| 162 | 162 | $this->requireValidCollection(); | 
| @@ -164,16 +164,16 @@ discard block | ||
| 164 | 164 | return $this->makeSafePartial(); | 
| 165 | 165 | } | 
| 166 | 166 | |
| 167 | - /** | |
| 168 | - * Like makeSafe(), but allows partial (invalid) commands: use this | |
| 169 | - * if the subject string may contain only part of the whole set of | |
| 170 | - * commands. | |
| 171 | - * | |
| 172 | - * Example: parsing a text with an opening if statement, without the | |
| 173 | - * matching end statement. | |
| 174 | - * | |
| 175 | - * @return string | |
| 176 | - */ | |
| 167 | + /** | |
| 168 | + * Like makeSafe(), but allows partial (invalid) commands: use this | |
| 169 | + * if the subject string may contain only part of the whole set of | |
| 170 | + * commands. | |
| 171 | + * | |
| 172 | + * Example: parsing a text with an opening if statement, without the | |
| 173 | + * matching end statement. | |
| 174 | + * | |
| 175 | + * @return string | |
| 176 | + */ | |
| 177 | 177 | public function makeSafePartial() : string | 
| 178 | 178 |      { | 
| 179 | 179 | $placeholders = $this->getPlaceholders(); | 
| @@ -257,13 +257,13 @@ discard block | ||
| 257 | 257 | $analyzer->analyze(); | 
| 258 | 258 | } | 
| 259 | 259 | |
| 260 | - /** | |
| 261 | - * Creates a formatting handler, which can be used to specify | |
| 262 | - * which formattings to use for the commands in the subject string. | |
| 263 | - * | |
| 264 | - * @param Mailcode_StringContainer|string $subject | |
| 265 | - * @return Mailcode_Parser_Safeguard_Formatting | |
| 266 | - */ | |
| 260 | + /** | |
| 261 | + * Creates a formatting handler, which can be used to specify | |
| 262 | + * which formattings to use for the commands in the subject string. | |
| 263 | + * | |
| 264 | + * @param Mailcode_StringContainer|string $subject | |
| 265 | + * @return Mailcode_Parser_Safeguard_Formatting | |
| 266 | + */ | |
| 267 | 267 | public function createFormatting($subject) : Mailcode_Parser_Safeguard_Formatting | 
| 268 | 268 |      { | 
| 269 | 269 | if(is_string($subject)) | 
| @@ -274,12 +274,12 @@ discard block | ||
| 274 | 274 | return new Mailcode_Parser_Safeguard_Formatting($this, $subject); | 
| 275 | 275 | } | 
| 276 | 276 | |
| 277 | - /** | |
| 278 | - * Retrieves all placeholders that have to be added to | |
| 279 | - * the subject text. | |
| 280 | - * | |
| 281 | - * @return \Mailcode\Mailcode_Parser_Safeguard_Placeholder[] | |
| 282 | - */ | |
| 277 | + /** | |
| 278 | + * Retrieves all placeholders that have to be added to | |
| 279 | + * the subject text. | |
| 280 | + * | |
| 281 | + * @return \Mailcode\Mailcode_Parser_Safeguard_Placeholder[] | |
| 282 | + */ | |
| 283 | 283 | public function getPlaceholders() | 
| 284 | 284 |      { | 
| 285 | 285 | if(isset($this->placeholders)) | 
| @@ -355,16 +355,16 @@ discard block | ||
| 355 | 355 | return $string; | 
| 356 | 356 | } | 
| 357 | 357 | |
| 358 | - /** | |
| 359 | - * Makes the string whole again after transforming or filtering it, | |
| 360 | - * by replacing the command placeholders with the original commands. | |
| 361 | - * | |
| 362 | - * @param string $string | |
| 363 | - * @return string | |
| 364 | - * @throws Mailcode_Exception | |
| 365 | - * | |
| 366 | - * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS | |
| 367 | - */ | |
| 358 | + /** | |
| 359 | + * Makes the string whole again after transforming or filtering it, | |
| 360 | + * by replacing the command placeholders with the original commands. | |
| 361 | + * | |
| 362 | + * @param string $string | |
| 363 | + * @return string | |
| 364 | + * @throws Mailcode_Exception | |
| 365 | + * | |
| 366 | + * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS | |
| 367 | + */ | |
| 368 | 368 | public function makeWhole(string $string) : string | 
| 369 | 369 |      { | 
| 370 | 370 | return $this->restore( | 
| @@ -374,15 +374,15 @@ discard block | ||
| 374 | 374 | ); | 
| 375 | 375 | } | 
| 376 | 376 | |
| 377 | - /** | |
| 378 | - * Like `makeWhole()`, but ignores missing command placeholders. | |
| 379 | - * | |
| 380 | - * @param string $string | |
| 381 | - * @return string | |
| 382 | - * @throws Mailcode_Exception | |
| 383 | - * | |
| 384 | - * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS | |
| 385 | - */ | |
| 377 | + /** | |
| 378 | + * Like `makeWhole()`, but ignores missing command placeholders. | |
| 379 | + * | |
| 380 | + * @param string $string | |
| 381 | + * @return string | |
| 382 | + * @throws Mailcode_Exception | |
| 383 | + * | |
| 384 | + * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS | |
| 385 | + */ | |
| 386 | 386 | public function makeWholePartial(string $string) : string | 
| 387 | 387 |      { | 
| 388 | 388 | return $this->restore( | 
| @@ -392,19 +392,19 @@ discard block | ||
| 392 | 392 | ); | 
| 393 | 393 | } | 
| 394 | 394 | |
| 395 | - /** | |
| 396 | - * Like `makeWhole()`, but replaces the commands with a syntax | |
| 397 | - * highlighted version, meant for human readable texts only. | |
| 398 | - * | |
| 399 | - * Note: the commands lose their functionality (They cannot be | |
| 400 | - * parsed from that string again). | |
| 401 | - * | |
| 402 | - * @param string $string | |
| 403 | - * @return string | |
| 404 | - * @throws Mailcode_Exception | |
| 405 | - * | |
| 406 | - * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS | |
| 407 | - */ | |
| 395 | + /** | |
| 396 | + * Like `makeWhole()`, but replaces the commands with a syntax | |
| 397 | + * highlighted version, meant for human readable texts only. | |
| 398 | + * | |
| 399 | + * Note: the commands lose their functionality (They cannot be | |
| 400 | + * parsed from that string again). | |
| 401 | + * | |
| 402 | + * @param string $string | |
| 403 | + * @return string | |
| 404 | + * @throws Mailcode_Exception | |
| 405 | + * | |
| 406 | + * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS | |
| 407 | + */ | |
| 408 | 408 | public function makeHighlighted(string $string) : string | 
| 409 | 409 |      { | 
| 410 | 410 | return $this->restore( | 
| @@ -414,15 +414,15 @@ discard block | ||
| 414 | 414 | ); | 
| 415 | 415 | } | 
| 416 | 416 | |
| 417 | - /** | |
| 418 | - * Like `makeHighlighted()`, but ignores missing command placeholders. | |
| 419 | - * | |
| 420 | - * @param string $string | |
| 421 | - * @return string | |
| 422 | - * @throws Mailcode_Exception | |
| 423 | - * | |
| 424 | - * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS | |
| 425 | - */ | |
| 417 | + /** | |
| 418 | + * Like `makeHighlighted()`, but ignores missing command placeholders. | |
| 419 | + * | |
| 420 | + * @param string $string | |
| 421 | + * @return string | |
| 422 | + * @throws Mailcode_Exception | |
| 423 | + * | |
| 424 | + * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS | |
| 425 | + */ | |
| 426 | 426 | public function makeHighlightedPartial(string $string) : string | 
| 427 | 427 |      { | 
| 428 | 428 | return $this->restore( | 
| @@ -432,11 +432,11 @@ discard block | ||
| 432 | 432 | ); | 
| 433 | 433 | } | 
| 434 | 434 | |
| 435 | - /** | |
| 436 | - * Retrieves the commands collection contained in the string. | |
| 437 | - * | |
| 438 | - * @return Mailcode_Collection | |
| 439 | - */ | |
| 435 | + /** | |
| 436 | + * Retrieves the commands collection contained in the string. | |
| 437 | + * | |
| 438 | + * @return Mailcode_Collection | |
| 439 | + */ | |
| 440 | 440 | public function getCollection() : Mailcode_Collection | 
| 441 | 441 |      { | 
| 442 | 442 | if(isset($this->collection)) | 
| @@ -454,11 +454,11 @@ discard block | ||
| 454 | 454 | return $this->getCollection()->isValid(); | 
| 455 | 455 | } | 
| 456 | 456 | |
| 457 | - /** | |
| 458 | - * @throws Mailcode_Exception | |
| 459 | - * | |
| 460 | - * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS | |
| 461 | - */ | |
| 457 | + /** | |
| 458 | + * @throws Mailcode_Exception | |
| 459 | + * | |
| 460 | + * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS | |
| 461 | + */ | |
| 462 | 462 | protected function requireValidCollection() : void | 
| 463 | 463 |      { | 
| 464 | 464 | if($this->getCollection()->isValid()) | 
| @@ -481,11 +481,11 @@ discard block | ||
| 481 | 481 | throw $exception; | 
| 482 | 482 | } | 
| 483 | 483 | |
| 484 | - /** | |
| 485 | - * Retrieves a list of all placeholder IDs used in the text. | |
| 486 | - * | |
| 487 | - * @return string[] | |
| 488 | - */ | |
| 484 | + /** | |
| 485 | + * Retrieves a list of all placeholder IDs used in the text. | |
| 486 | + * | |
| 487 | + * @return string[] | |
| 488 | + */ | |
| 489 | 489 | public function getPlaceholderStrings() : array | 
| 490 | 490 |      { | 
| 491 | 491 | if(is_array($this->placeholderStrings)) | 
| @@ -512,13 +512,13 @@ discard block | ||
| 512 | 512 | return in_array($subject, $ids, true); | 
| 513 | 513 | } | 
| 514 | 514 | |
| 515 | - /** | |
| 516 | - * Retrieves a placeholder instance by its ID. | |
| 517 | - * | |
| 518 | - * @param int $id | |
| 519 | - * @throws Mailcode_Exception If the placeholder was not found. | |
| 520 | - * @return Mailcode_Parser_Safeguard_Placeholder | |
| 521 | - */ | |
| 515 | + /** | |
| 516 | + * Retrieves a placeholder instance by its ID. | |
| 517 | + * | |
| 518 | + * @param int $id | |
| 519 | + * @throws Mailcode_Exception If the placeholder was not found. | |
| 520 | + * @return Mailcode_Parser_Safeguard_Placeholder | |
| 521 | + */ | |
| 522 | 522 | public function getPlaceholderByID(int $id) : Mailcode_Parser_Safeguard_Placeholder | 
| 523 | 523 |      { | 
| 524 | 524 | $placeholders = $this->getPlaceholders(); | 
| @@ -541,13 +541,13 @@ discard block | ||
| 541 | 541 | ); | 
| 542 | 542 | } | 
| 543 | 543 | |
| 544 | - /** | |
| 545 | - * Retrieves a placeholder instance by its replacement text. | |
| 546 | - * | |
| 547 | - * @param string $string | |
| 548 | - * @throws Mailcode_Exception | |
| 549 | - * @return Mailcode_Parser_Safeguard_Placeholder | |
| 550 | - */ | |
| 544 | + /** | |
| 545 | + * Retrieves a placeholder instance by its replacement text. | |
| 546 | + * | |
| 547 | + * @param string $string | |
| 548 | + * @throws Mailcode_Exception | |
| 549 | + * @return Mailcode_Parser_Safeguard_Placeholder | |
| 550 | + */ | |
| 551 | 551 | public function getPlaceholderByString(string $string) : Mailcode_Parser_Safeguard_Placeholder | 
| 552 | 552 |      { | 
| 553 | 553 | $placeholders = $this->getPlaceholders(); | 
| @@ -28,8 +28,8 @@ discard block | ||
| 28 | 28 | const URL_ENCODING_DECODE = 'decode'; | 
| 29 | 29 | |
| 30 | 30 | /** | 
| 31 | - * @var Mailcode_Factory_CommandSets | |
| 32 | - */ | |
| 31 | + * @var Mailcode_Factory_CommandSets | |
| 32 | + */ | |
| 33 | 33 | private static $commandSets; | 
| 34 | 34 | |
| 35 | 35 | /** | 
| @@ -83,33 +83,33 @@ discard block | ||
| 83 | 83 | } | 
| 84 | 84 | |
| 85 | 85 | /** | 
| 86 | - * Creates a renderer instance, which can be used to easily | |
| 87 | - * create and convert commands to strings. | |
| 88 | - * | |
| 89 | - * @return Mailcode_Renderer | |
| 90 | - */ | |
| 86 | + * Creates a renderer instance, which can be used to easily | |
| 87 | + * create and convert commands to strings. | |
| 88 | + * | |
| 89 | + * @return Mailcode_Renderer | |
| 90 | + */ | |
| 91 | 91 | public static function createRenderer() : Mailcode_Renderer | 
| 92 | 92 |      { | 
| 93 | 93 | return new Mailcode_Renderer(); | 
| 94 | 94 | } | 
| 95 | 95 | |
| 96 | - /** | |
| 97 | - * Creates a printer instance, which works like the renderer, | |
| 98 | - * but outputs the generated strings to standard output. | |
| 99 | - * | |
| 100 | - * @return Mailcode_Printer | |
| 101 | - */ | |
| 96 | + /** | |
| 97 | + * Creates a printer instance, which works like the renderer, | |
| 98 | + * but outputs the generated strings to standard output. | |
| 99 | + * | |
| 100 | + * @return Mailcode_Printer | |
| 101 | + */ | |
| 102 | 102 | public static function createPrinter() : Mailcode_Printer | 
| 103 | 103 |      { | 
| 104 | 104 | return new Mailcode_Printer(); | 
| 105 | 105 | } | 
| 106 | 106 | |
| 107 | - /** | |
| 108 | - * Gets/creates the global instance of the date format info | |
| 109 | - * class, used to handle date formatting aspects. | |
| 110 | - * | |
| 111 | - * @return Mailcode_Date_FormatInfo | |
| 112 | - */ | |
| 107 | + /** | |
| 108 | + * Gets/creates the global instance of the date format info | |
| 109 | + * class, used to handle date formatting aspects. | |
| 110 | + * | |
| 111 | + * @return Mailcode_Date_FormatInfo | |
| 112 | + */ | |
| 113 | 113 | public static function createDateInfo() : Mailcode_Date_FormatInfo | 
| 114 | 114 |      { | 
| 115 | 115 | return Mailcode_Date_FormatInfo::getInstance(); | 
| @@ -23,9 +23,9 @@ discard block | ||
| 23 | 23 |  { | 
| 24 | 24 | const ERROR_UNKNOWN_COMMAND_TYPE = 50401; | 
| 25 | 25 | |
| 26 | - /** | |
| 27 | - * @var string | |
| 28 | - */ | |
| 26 | + /** | |
| 27 | + * @var string | |
| 28 | + */ | |
| 29 | 29 | protected $typeID; | 
| 30 | 30 | |
| 31 | 31 | public function __construct(string $typeID) | 
| @@ -33,22 +33,22 @@ discard block | ||
| 33 | 33 | $this->typeID = $typeID; | 
| 34 | 34 | } | 
| 35 | 35 | |
| 36 | - /** | |
| 37 | - * Retrieves the syntax' type ID, e.g. "ApacheVelocity". | |
| 38 | - * @return string | |
| 39 | - */ | |
| 36 | + /** | |
| 37 | + * Retrieves the syntax' type ID, e.g. "ApacheVelocity". | |
| 38 | + * @return string | |
| 39 | + */ | |
| 40 | 40 | public function getTypeID() : string | 
| 41 | 41 |      { | 
| 42 | 42 | return $this->typeID; | 
| 43 | 43 | } | 
| 44 | 44 | |
| 45 | - /** | |
| 46 | - * Translates a single command to the target syntax. | |
| 47 | - * | |
| 48 | - * @param Mailcode_Commands_Command $command | |
| 49 | - * @throws Mailcode_Translator_Exception | |
| 50 | - * @return string | |
| 51 | - */ | |
| 45 | + /** | |
| 46 | + * Translates a single command to the target syntax. | |
| 47 | + * | |
| 48 | + * @param Mailcode_Commands_Command $command | |
| 49 | + * @throws Mailcode_Translator_Exception | |
| 50 | + * @return string | |
| 51 | + */ | |
| 52 | 52 | public function translateCommand(Mailcode_Commands_Command $command) : string | 
| 53 | 53 |      { | 
| 54 | 54 | $translator = $this->createTranslator($command); | 
| @@ -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', | 
| @@ -240,7 +240,7 @@ discard block | ||
| 240 | 240 |      { | 
| 241 | 241 | $val = $this->validator->createStringLiteral(); | 
| 242 | 242 | |
| 243 | - if($val->isValid()) | |
| 243 | + if ($val->isValid()) | |
| 244 | 244 |          { | 
| 245 | 245 | $this->sourceFormat = strtoupper($val->getToken()->getText()); | 
| 246 | 246 | return; | 
| @@ -258,7 +258,7 @@ discard block | ||
| 258 | 258 | */ | 
| 259 | 259 | protected function validateSyntax_country_code(): void | 
| 260 | 260 |      { | 
| 261 | -        if(isset(self::$supportedCountries[$this->sourceFormat])) { | |
| 261 | +        if (isset(self::$supportedCountries[$this->sourceFormat])) { | |
| 262 | 262 | return; | 
| 263 | 263 | } | 
| 264 | 264 | |
| @@ -20,15 +20,15 @@ discard block | ||
| 20 | 20 | */ | 
| 21 | 21 | class Mailcode_Commands_Command_ShowDate extends Mailcode_Commands_ShowBase | 
| 22 | 22 |  { | 
| 23 | - /** | |
| 24 | - * The date format string. | |
| 25 | - * @var string | |
| 26 | - */ | |
| 23 | + /** | |
| 24 | + * The date format string. | |
| 25 | + * @var string | |
| 26 | + */ | |
| 27 | 27 | private $formatString; | 
| 28 | 28 | |
| 29 | - /** | |
| 30 | - * @var Mailcode_Date_FormatInfo | |
| 31 | - */ | |
| 29 | + /** | |
| 30 | + * @var Mailcode_Date_FormatInfo | |
| 31 | + */ | |
| 32 | 32 | private $formatInfo; | 
| 33 | 33 | |
| 34 | 34 | public function getName() : string | 
| @@ -88,11 +88,11 @@ discard block | ||
| 88 | 88 | ); | 
| 89 | 89 | } | 
| 90 | 90 | |
| 91 | - /** | |
| 92 | - * Retrieves the format string used to format the date. | |
| 93 | - * | |
| 94 | - * @return string A PHP compatible date format string. | |
| 95 | - */ | |
| 91 | + /** | |
| 92 | + * Retrieves the format string used to format the date. | |
| 93 | + * | |
| 94 | + * @return string A PHP compatible date format string. | |
| 95 | + */ | |
| 96 | 96 | public function getFormatString() : string | 
| 97 | 97 |      { | 
| 98 | 98 | return $this->formatString; |