@@ -12,7 +12,7 @@  | 
                                                    ||
| 12 | 12 | $autoload = realpath($root.'/../vendor/autoload.php');  | 
                                                        
| 13 | 13 | |
| 14 | 14 | // we need the autoloader to be present  | 
                                                        
| 15 | - if($autoload === false)  | 
                                                        |
| 15 | + if ($autoload === false)  | 
                                                        |
| 16 | 16 |      { | 
                                                        
| 17 | 17 |          die('<b>ERROR:</b> Autoloader not present. Run composer update first.'); | 
                                                        
| 18 | 18 | }  | 
                                                        
@@ -32,7 +32,7 @@ discard block  | 
                                                    ||
| 32 | 32 | |
| 33 | 33 | public function add(Mailcode_Variables_Variable $variable) : Mailcode_Variables_Collection  | 
                                                        
| 34 | 34 |      { | 
                                                        
| 35 | - if(!$variable->isValid())  | 
                                                        |
| 35 | + if (!$variable->isValid())  | 
                                                        |
| 36 | 36 |          { | 
                                                        
| 37 | 37 | return $this->addInvalid($variable);  | 
                                                        
| 38 | 38 | }  | 
                                                        
@@ -76,7 +76,7 @@ discard block  | 
                                                    ||
| 76 | 76 | parent::mergeWith($collection);  | 
                                                        
| 77 | 77 | |
| 78 | 78 | // also inherit any invalid variables  | 
                                                        
| 79 | - if($collection instanceof Mailcode_Variables_Collection_Regular)  | 
                                                        |
| 79 | + if ($collection instanceof Mailcode_Variables_Collection_Regular)  | 
                                                        |
| 80 | 80 |          { | 
                                                        
| 81 | 81 | $invalid = $collection->getInvalid();  | 
                                                        
| 82 | 82 | |
@@ -20,9 +20,9 @@ discard block  | 
                                                    ||
| 20 | 20 | */  | 
                                                        
| 21 | 21 | class Mailcode_Variables_Collection_Regular extends Mailcode_Variables_Collection  | 
                                                        
| 22 | 22 |  { | 
                                                        
| 23 | - /**  | 
                                                        |
| 24 | - * @var Mailcode_Variables_Collection_Invalid  | 
                                                        |
| 25 | - */  | 
                                                        |
| 23 | + /**  | 
                                                        |
| 24 | + * @var Mailcode_Variables_Collection_Invalid  | 
                                                        |
| 25 | + */  | 
                                                        |
| 26 | 26 | protected Mailcode_Variables_Collection_Invalid $invalid;  | 
                                                        
| 27 | 27 | |
| 28 | 28 | protected function init() : void  | 
                                                        
@@ -47,30 +47,30 @@ discard block  | 
                                                    ||
| 47 | 47 | return $this;  | 
                                                        
| 48 | 48 | }  | 
                                                        
| 49 | 49 | |
| 50 | - /**  | 
                                                        |
| 51 | - * Whether any of the variables in the collection are invalid.  | 
                                                        |
| 52 | - *  | 
                                                        |
| 53 | - * @return bool  | 
                                                        |
| 54 | - */  | 
                                                        |
| 50 | + /**  | 
                                                        |
| 51 | + * Whether any of the variables in the collection are invalid.  | 
                                                        |
| 52 | + *  | 
                                                        |
| 53 | + * @return bool  | 
                                                        |
| 54 | + */  | 
                                                        |
| 55 | 55 | public function hasInvalid() : bool  | 
                                                        
| 56 | 56 |      { | 
                                                        
| 57 | 57 | return $this->invalid->hasVariables();  | 
                                                        
| 58 | 58 | }  | 
                                                        
| 59 | 59 | |
| 60 | - /**  | 
                                                        |
| 61 | - * Retrieves the collection of invalid variables, if any.  | 
                                                        |
| 62 | - * Behaves like a variables collection.  | 
                                                        |
| 63 | - *  | 
                                                        |
| 64 | - * @return Mailcode_Variables_Collection_Invalid  | 
                                                        |
| 65 | - */  | 
                                                        |
| 60 | + /**  | 
                                                        |
| 61 | + * Retrieves the collection of invalid variables, if any.  | 
                                                        |
| 62 | + * Behaves like a variables collection.  | 
                                                        |
| 63 | + *  | 
                                                        |
| 64 | + * @return Mailcode_Variables_Collection_Invalid  | 
                                                        |
| 65 | + */  | 
                                                        |
| 66 | 66 | public function getInvalid() : Mailcode_Variables_Collection_Invalid  | 
                                                        
| 67 | 67 |      { | 
                                                        
| 68 | 68 | return $this->invalid;  | 
                                                        
| 69 | 69 | }  | 
                                                        
| 70 | 70 | |
| 71 | - /**  | 
                                                        |
| 72 | - * @return Mailcode_Variables_Collection_Regular  | 
                                                        |
| 73 | - */  | 
                                                        |
| 71 | + /**  | 
                                                        |
| 72 | + * @return Mailcode_Variables_Collection_Regular  | 
                                                        |
| 73 | + */  | 
                                                        |
| 74 | 74 | public function mergeWith(Mailcode_Variables_Collection $collection) : Mailcode_Variables_Collection  | 
                                                        
| 75 | 75 |      { | 
                                                        
| 76 | 76 | parent::mergeWith($collection);  | 
                                                        
@@ -23,7 +23,7 @@  | 
                                                    ||
| 23 | 23 | */  | 
                                                        
| 24 | 24 | function init() : void  | 
                                                        
| 25 | 25 |  { | 
                                                        
| 26 | -    if(!class_exists('\AppLocalize\Localization')) { | 
                                                        |
| 26 | +    if (!class_exists('\AppLocalize\Localization')) { | 
                                                        |
| 27 | 27 | return;  | 
                                                        
| 28 | 28 | }  | 
                                                        
| 29 | 29 | |
@@ -20,18 +20,18 @@ discard block  | 
                                                    ||
| 20 | 20 | */  | 
                                                        
| 21 | 21 | class Mailcode_Factory_Exception extends Mailcode_Exception  | 
                                                        
| 22 | 22 |  { | 
                                                        
| 23 | - /**  | 
                                                        |
| 24 | - * @var Mailcode_Commands_Command|NULL  | 
                                                        |
| 25 | - */  | 
                                                        |
| 23 | + /**  | 
                                                        |
| 24 | + * @var Mailcode_Commands_Command|NULL  | 
                                                        |
| 25 | + */  | 
                                                        |
| 26 | 26 | protected $command;  | 
                                                        
| 27 | 27 | |
| 28 | - /**  | 
                                                        |
| 29 | - * @param string $message  | 
                                                        |
| 30 | - * @param string|NULL $details  | 
                                                        |
| 31 | - * @param int|NULL $code  | 
                                                        |
| 32 | - * @param \Exception|NULL $previous  | 
                                                        |
| 33 | - * @param Mailcode_Commands_Command|NULL $command  | 
                                                        |
| 34 | - */  | 
                                                        |
| 28 | + /**  | 
                                                        |
| 29 | + * @param string $message  | 
                                                        |
| 30 | + * @param string|NULL $details  | 
                                                        |
| 31 | + * @param int|NULL $code  | 
                                                        |
| 32 | + * @param \Exception|NULL $previous  | 
                                                        |
| 33 | + * @param Mailcode_Commands_Command|NULL $command  | 
                                                        |
| 34 | + */  | 
                                                        |
| 35 | 35 | public function __construct(string $message, $details=null, $code=null, $previous=null, Mailcode_Commands_Command $command=null)  | 
                                                        
| 36 | 36 |      { | 
                                                        
| 37 | 37 | parent::__construct($message, $details, $code, $previous);  | 
                                                        
@@ -39,11 +39,11 @@ discard block  | 
                                                    ||
| 39 | 39 | $this->command = $command;  | 
                                                        
| 40 | 40 | }  | 
                                                        
| 41 | 41 | |
| 42 | - /**  | 
                                                        |
| 43 | - * Retrieves the erroneous command, if any.  | 
                                                        |
| 44 | - *  | 
                                                        |
| 45 | - * @return Mailcode_Commands_Command|NULL  | 
                                                        |
| 46 | - */  | 
                                                        |
| 42 | + /**  | 
                                                        |
| 43 | + * Retrieves the erroneous command, if any.  | 
                                                        |
| 44 | + *  | 
                                                        |
| 45 | + * @return Mailcode_Commands_Command|NULL  | 
                                                        |
| 46 | + */  | 
                                                        |
| 47 | 47 | public function getCommand() : ?Mailcode_Commands_Command  | 
                                                        
| 48 | 48 |      { | 
                                                        
| 49 | 49 | return $this->command;  | 
                                                        
@@ -32,7 +32,7 @@  | 
                                                    ||
| 32 | 32 | * @param \Exception|NULL $previous  | 
                                                        
| 33 | 33 | * @param Mailcode_Commands_Command|NULL $command  | 
                                                        
| 34 | 34 | */  | 
                                                        
| 35 | - public function __construct(string $message, $details=null, $code=null, $previous=null, Mailcode_Commands_Command $command=null)  | 
                                                        |
| 35 | + public function __construct(string $message, $details = null, $code = null, $previous = null, Mailcode_Commands_Command $command = null)  | 
                                                        |
| 36 | 36 |      { | 
                                                        
| 37 | 37 | parent::__construct($message, $details, $code, $previous);  | 
                                                        
| 38 | 38 | |
@@ -87,7 +87,7 @@  | 
                                                    ||
| 87 | 87 | */  | 
                                                        
| 88 | 88 | public function getTypeLabel() : string  | 
                                                        
| 89 | 89 |      { | 
                                                        
| 90 | - switch($this->type)  | 
                                                        |
| 90 | + switch ($this->type)  | 
                                                        |
| 91 | 91 |          { | 
                                                        
| 92 | 92 | case Mailcode_Date_FormatInfo::CHARTYPE_DATE:  | 
                                                        
| 93 | 93 |                  return t('Date'); | 
                                                        
@@ -23,19 +23,19 @@ discard block  | 
                                                    ||
| 23 | 23 |  { | 
                                                        
| 24 | 24 | public const ERROR_UNHANDLED_CHARTYPE = 55601;  | 
                                                        
| 25 | 25 | |
| 26 | - /**  | 
                                                        |
| 27 | - * @var string  | 
                                                        |
| 28 | - */  | 
                                                        |
| 26 | + /**  | 
                                                        |
| 27 | + * @var string  | 
                                                        |
| 28 | + */  | 
                                                        |
| 29 | 29 | private $type;  | 
                                                        
| 30 | 30 | |
| 31 | - /**  | 
                                                        |
| 32 | - * @var string  | 
                                                        |
| 33 | - */  | 
                                                        |
| 31 | + /**  | 
                                                        |
| 32 | + * @var string  | 
                                                        |
| 33 | + */  | 
                                                        |
| 34 | 34 | private $char;  | 
                                                        
| 35 | 35 | |
| 36 | - /**  | 
                                                        |
| 37 | - * @var string  | 
                                                        |
| 38 | - */  | 
                                                        |
| 36 | + /**  | 
                                                        |
| 37 | + * @var string  | 
                                                        |
| 38 | + */  | 
                                                        |
| 39 | 39 | private $description;  | 
                                                        
| 40 | 40 | |
| 41 | 41 | public function __construct(string $type, string $char, string $description)  | 
                                                        
@@ -45,46 +45,46 @@ discard block  | 
                                                    ||
| 45 | 45 | $this->description = $description;  | 
                                                        
| 46 | 46 | }  | 
                                                        
| 47 | 47 | |
| 48 | - /**  | 
                                                        |
| 49 | - * Retrieves the format character (PHP date format).  | 
                                                        |
| 50 | - *  | 
                                                        |
| 51 | - * @return string  | 
                                                        |
| 52 | - */  | 
                                                        |
| 48 | + /**  | 
                                                        |
| 49 | + * Retrieves the format character (PHP date format).  | 
                                                        |
| 50 | + *  | 
                                                        |
| 51 | + * @return string  | 
                                                        |
| 52 | + */  | 
                                                        |
| 53 | 53 | public function getChar() : string  | 
                                                        
| 54 | 54 |      { | 
                                                        
| 55 | 55 | return $this->char;  | 
                                                        
| 56 | 56 | }  | 
                                                        
| 57 | 57 | |
| 58 | - /**  | 
                                                        |
| 59 | - * Retrieves a human readable description of the character's role.  | 
                                                        |
| 60 | - *  | 
                                                        |
| 61 | - * @return string  | 
                                                        |
| 62 | - */  | 
                                                        |
| 58 | + /**  | 
                                                        |
| 59 | + * Retrieves a human readable description of the character's role.  | 
                                                        |
| 60 | + *  | 
                                                        |
| 61 | + * @return string  | 
                                                        |
| 62 | + */  | 
                                                        |
| 63 | 63 | public function getDescription() : string  | 
                                                        
| 64 | 64 |      { | 
                                                        
| 65 | 65 | return $this->description;  | 
                                                        
| 66 | 66 | }  | 
                                                        
| 67 | 67 | |
| 68 | - /**  | 
                                                        |
| 69 | - * Retrieves the character type ID.  | 
                                                        |
| 70 | - *  | 
                                                        |
| 71 | - * @return string  | 
                                                        |
| 72 | - *  | 
                                                        |
| 73 | - * @see Mailcode_Date_FormatInfo::CHARTYPE_DATE  | 
                                                        |
| 74 | - * @see Mailcode_Date_FormatInfo::CHARTYPE_TIME  | 
                                                        |
| 75 | - * @see Mailcode_Date_FormatInfo::CHARTYPE_PUNCTUATION  | 
                                                        |
| 76 | - */  | 
                                                        |
| 68 | + /**  | 
                                                        |
| 69 | + * Retrieves the character type ID.  | 
                                                        |
| 70 | + *  | 
                                                        |
| 71 | + * @return string  | 
                                                        |
| 72 | + *  | 
                                                        |
| 73 | + * @see Mailcode_Date_FormatInfo::CHARTYPE_DATE  | 
                                                        |
| 74 | + * @see Mailcode_Date_FormatInfo::CHARTYPE_TIME  | 
                                                        |
| 75 | + * @see Mailcode_Date_FormatInfo::CHARTYPE_PUNCTUATION  | 
                                                        |
| 76 | + */  | 
                                                        |
| 77 | 77 | public function getTypeID() : string  | 
                                                        
| 78 | 78 |      { | 
                                                        
| 79 | 79 | return $this->type;  | 
                                                        
| 80 | 80 | }  | 
                                                        
| 81 | 81 | |
| 82 | - /**  | 
                                                        |
| 83 | - * Retrieves a human readable label for the character's type, e.g. "Date", "Time", "Punctuation".  | 
                                                        |
| 84 | - *  | 
                                                        |
| 85 | - * @throws Mailcode_Exception If the character type is unknown.  | 
                                                        |
| 86 | - * @return string  | 
                                                        |
| 87 | - */  | 
                                                        |
| 82 | + /**  | 
                                                        |
| 83 | + * Retrieves a human readable label for the character's type, e.g. "Date", "Time", "Punctuation".  | 
                                                        |
| 84 | + *  | 
                                                        |
| 85 | + * @throws Mailcode_Exception If the character type is unknown.  | 
                                                        |
| 86 | + * @return string  | 
                                                        |
| 87 | + */  | 
                                                        |
| 88 | 88 | public function getTypeLabel() : string  | 
                                                        
| 89 | 89 |      { | 
                                                        
| 90 | 90 | switch($this->type)  | 
                                                        
@@ -31,7 +31,7 @@  | 
                                                    ||
| 31 | 31 | |
| 32 | 32 | $this->instantiator->checkCommand($cmd);  | 
                                                        
| 33 | 33 | |
| 34 | - if($cmd instanceof Mailcode_Commands_Command_Else)  | 
                                                        |
| 34 | + if ($cmd instanceof Mailcode_Commands_Command_Else)  | 
                                                        |
| 35 | 35 |          { | 
                                                        
| 36 | 36 | return $cmd;  | 
                                                        
| 37 | 37 | }  | 
                                                        
@@ -20,7 +20,8 @@ discard block  | 
                                                    ||
| 20 | 20 | */  | 
                                                        
| 21 | 21 | abstract class Mailcode_Factory_CommandSets_IfBase extends Mailcode_Factory_CommandSets_Set  | 
                                                        
| 22 | 22 |  { | 
                                                        
| 23 | - public function else() : Mailcode_Commands_Command_Else  | 
                                                        |
| 23 | +    public function else { | 
                                                        |
| 24 | + () : Mailcode_Commands_Command_Else  | 
                                                        |
| 24 | 25 |      { | 
                                                        
| 25 | 26 | $cmd = Mailcode::create()->getCommands()->createCommand(  | 
                                                        
| 26 | 27 | 'Else',  | 
                                                        
@@ -28,6 +29,7 @@ discard block  | 
                                                    ||
| 28 | 29 | '',  | 
                                                        
| 29 | 30 |              '{else}' | 
                                                        
| 30 | 31 | );  | 
                                                        
| 32 | + }  | 
                                                        |
| 31 | 33 | |
| 32 | 34 | $this->instantiator->checkCommand($cmd);  | 
                                                        
| 33 | 35 | |
@@ -39,7 +39,7 @@  | 
                                                    ||
| 39 | 39 | $folder = sprintf(__DIR__.'/../../css/%s', $this->fileName);  | 
                                                        
| 40 | 40 | $path = realpath($folder);  | 
                                                        
| 41 | 41 | |
| 42 | - if($path === false)  | 
                                                        |
| 42 | + if ($path === false)  | 
                                                        |
| 43 | 43 |          { | 
                                                        
| 44 | 44 | throw new Mailcode_Exception(  | 
                                                        
| 45 | 45 | 'Could not find the highlight CSS file',  | 
                                                        
@@ -25,14 +25,14 @@ discard block  | 
                                                    ||
| 25 | 25 |  { | 
                                                        
| 26 | 26 | public const ERROR_CSS_FILE_NOT_FOUND = 60901;  | 
                                                        
| 27 | 27 | |
| 28 | - /**  | 
                                                        |
| 29 | - * @var string  | 
                                                        |
| 30 | - */  | 
                                                        |
| 28 | + /**  | 
                                                        |
| 29 | + * @var string  | 
                                                        |
| 30 | + */  | 
                                                        |
| 31 | 31 | private string $path;  | 
                                                        
| 32 | 32 | |
| 33 | - /**  | 
                                                        |
| 34 | - * @var string  | 
                                                        |
| 35 | - */  | 
                                                        |
| 33 | + /**  | 
                                                        |
| 34 | + * @var string  | 
                                                        |
| 35 | + */  | 
                                                        |
| 36 | 36 | private string $fileName = 'highlight.css';  | 
                                                        
| 37 | 37 | |
| 38 | 38 | public function __construct()  | 
                                                        
@@ -55,22 +55,22 @@ discard block  | 
                                                    ||
| 55 | 55 | $this->path = $path;  | 
                                                        
| 56 | 56 | }  | 
                                                        
| 57 | 57 | |
| 58 | - /**  | 
                                                        |
| 59 | - * Retrieves the raw CSS source for the highlighting.  | 
                                                        |
| 60 | - *  | 
                                                        |
| 61 | - * @return string  | 
                                                        |
| 62 | - */  | 
                                                        |
| 58 | + /**  | 
                                                        |
| 59 | + * Retrieves the raw CSS source for the highlighting.  | 
                                                        |
| 60 | + *  | 
                                                        |
| 61 | + * @return string  | 
                                                        |
| 62 | + */  | 
                                                        |
| 63 | 63 | public function getCSS() : string  | 
                                                        
| 64 | 64 |      { | 
                                                        
| 65 | 65 | return FileHelper::readContents($this->path);  | 
                                                        
| 66 | 66 | }  | 
                                                        
| 67 | 67 | |
| 68 | - /**  | 
                                                        |
| 69 | - * Retrieves a fully formed `code` tag with the CSS,  | 
                                                        |
| 70 | - * to inject inline into an HTML document.  | 
                                                        |
| 71 | - *  | 
                                                        |
| 72 | - * @return string  | 
                                                        |
| 73 | - */  | 
                                                        |
| 68 | + /**  | 
                                                        |
| 69 | + * Retrieves a fully formed `code` tag with the CSS,  | 
                                                        |
| 70 | + * to inject inline into an HTML document.  | 
                                                        |
| 71 | + *  | 
                                                        |
| 72 | + * @return string  | 
                                                        |
| 73 | + */  | 
                                                        |
| 74 | 74 | public function getStyleTag() : string  | 
                                                        
| 75 | 75 |      { | 
                                                        
| 76 | 76 | return sprintf(  | 
                                                        
@@ -79,23 +79,23 @@ discard block  | 
                                                    ||
| 79 | 79 | );  | 
                                                        
| 80 | 80 | }  | 
                                                        
| 81 | 81 | |
| 82 | - /**  | 
                                                        |
| 83 | - * Retrieves the path to the stylesheet file.  | 
                                                        |
| 84 | - *  | 
                                                        |
| 85 | - * @return string  | 
                                                        |
| 86 | - */  | 
                                                        |
| 82 | + /**  | 
                                                        |
| 83 | + * Retrieves the path to the stylesheet file.  | 
                                                        |
| 84 | + *  | 
                                                        |
| 85 | + * @return string  | 
                                                        |
| 86 | + */  | 
                                                        |
| 87 | 87 | public function getStylesheetPath() : string  | 
                                                        
| 88 | 88 |      { | 
                                                        
| 89 | 89 | return $this->path;  | 
                                                        
| 90 | 90 | }  | 
                                                        
| 91 | 91 | |
| 92 | - /**  | 
                                                        |
| 93 | - * Retrieves the URL to the stylesheet file, given the  | 
                                                        |
| 94 | - * local URL to the application's vendor folder.  | 
                                                        |
| 95 | - *  | 
                                                        |
| 96 | - * @param string $vendorURL The URL to the vendor folder (must be accessible in the webroot).  | 
                                                        |
| 97 | - * @return string  | 
                                                        |
| 98 | - */  | 
                                                        |
| 92 | + /**  | 
                                                        |
| 93 | + * Retrieves the URL to the stylesheet file, given the  | 
                                                        |
| 94 | + * local URL to the application's vendor folder.  | 
                                                        |
| 95 | + *  | 
                                                        |
| 96 | + * @param string $vendorURL The URL to the vendor folder (must be accessible in the webroot).  | 
                                                        |
| 97 | + * @return string  | 
                                                        |
| 98 | + */  | 
                                                        |
| 99 | 99 | public function getStylesheetURL(string $vendorURL) : string  | 
                                                        
| 100 | 100 |      { | 
                                                        
| 101 | 101 | return sprintf(  | 
                                                        
@@ -90,7 +90,7 @@ discard block  | 
                                                    ||
| 90 | 90 |      { | 
                                                        
| 91 | 91 | $string = $this->name;  | 
                                                        
| 92 | 92 | |
| 93 | - if(!empty($this->keywordType))  | 
                                                        |
| 93 | + if (!empty($this->keywordType))  | 
                                                        |
| 94 | 94 |          { | 
                                                        
| 95 | 95 | $string .= ' '.$this->keywordType;  | 
                                                        
| 96 | 96 | }  | 
                                                        
@@ -118,7 +118,7 @@ discard block  | 
                                                    ||
| 118 | 118 | */  | 
                                                        
| 119 | 119 | public function setParamsString(string $params) : void  | 
                                                        
| 120 | 120 |      { | 
                                                        
| 121 | - if($this->paramsSet)  | 
                                                        |
| 121 | + if ($this->paramsSet)  | 
                                                        |
| 122 | 122 |          { | 
                                                        
| 123 | 123 | throw new Mailcode_Exception(  | 
                                                        
| 124 | 124 | 'Cannot set parameters twice',  | 
                                                        
@@ -160,7 +160,7 @@ discard block  | 
                                                    ||
| 160 | 160 | |
| 161 | 161 | $command = $this->collection->getFirstCommand();  | 
                                                        
| 162 | 162 | |
| 163 | - if($command === null)  | 
                                                        |
| 163 | + if ($command === null)  | 
                                                        |
| 164 | 164 |          { | 
                                                        
| 165 | 165 | $this->makeError(  | 
                                                        
| 166 | 166 |                  t('No command could be created using the following string:').' '. | 
                                                        
@@ -172,7 +172,7 @@ discard block  | 
                                                    ||
| 172 | 172 | return;  | 
                                                        
| 173 | 173 | }  | 
                                                        
| 174 | 174 | |
| 175 | - if(!$command->isValid())  | 
                                                        |
| 175 | + if (!$command->isValid())  | 
                                                        |
| 176 | 176 |          { | 
                                                        
| 177 | 177 | $this->makeError(  | 
                                                        
| 178 | 178 |                  t('Invalid command created:').' '. | 
                                                        
@@ -192,7 +192,7 @@ discard block  | 
                                                    ||
| 192 | 192 |      { | 
                                                        
| 193 | 193 | $command = $this->collection->getFirstCommand();  | 
                                                        
| 194 | 194 | |
| 195 | - if($command !== null && $command->isValid())  | 
                                                        |
| 195 | + if ($command !== null && $command->isValid())  | 
                                                        |
| 196 | 196 |          { | 
                                                        
| 197 | 197 | return $command;  | 
                                                        
| 198 | 198 | }  | 
                                                        
@@ -29,39 +29,39 @@ discard block  | 
                                                    ||
| 29 | 29 | public const VALIDATION_NO_COMMAND_CREATED = 61101;  | 
                                                        
| 30 | 30 | public const VALIDATION_INVALID_COMMAND_CREATED = 61102;  | 
                                                        
| 31 | 31 | |
| 32 | - /**  | 
                                                        |
| 33 | - * @var Mailcode_Commands_LogicKeywords  | 
                                                        |
| 34 | - */  | 
                                                        |
| 32 | + /**  | 
                                                        |
| 33 | + * @var Mailcode_Commands_LogicKeywords  | 
                                                        |
| 34 | + */  | 
                                                        |
| 35 | 35 | private $keywords;  | 
                                                        
| 36 | 36 | |
| 37 | - /**  | 
                                                        |
| 38 | - * @var string  | 
                                                        |
| 39 | - */  | 
                                                        |
| 37 | + /**  | 
                                                        |
| 38 | + * @var string  | 
                                                        |
| 39 | + */  | 
                                                        |
| 40 | 40 | private $name;  | 
                                                        
| 41 | 41 | |
| 42 | - /**  | 
                                                        |
| 43 | - * @var string  | 
                                                        |
| 44 | - */  | 
                                                        |
| 42 | + /**  | 
                                                        |
| 43 | + * @var string  | 
                                                        |
| 44 | + */  | 
                                                        |
| 45 | 45 | private $keywordType;  | 
                                                        
| 46 | 46 | |
| 47 | - /**  | 
                                                        |
| 48 | - * @var string  | 
                                                        |
| 49 | - */  | 
                                                        |
| 47 | + /**  | 
                                                        |
| 48 | + * @var string  | 
                                                        |
| 49 | + */  | 
                                                        |
| 50 | 50 | private $matchedString;  | 
                                                        
| 51 | 51 | |
| 52 | - /**  | 
                                                        |
| 53 | - * @var string  | 
                                                        |
| 54 | - */  | 
                                                        |
| 52 | + /**  | 
                                                        |
| 53 | + * @var string  | 
                                                        |
| 54 | + */  | 
                                                        |
| 55 | 55 | private $params = '';  | 
                                                        
| 56 | 56 | |
| 57 | - /**  | 
                                                        |
| 58 | - * @var boolean  | 
                                                        |
| 59 | - */  | 
                                                        |
| 57 | + /**  | 
                                                        |
| 58 | + * @var boolean  | 
                                                        |
| 59 | + */  | 
                                                        |
| 60 | 60 | private $paramsSet = false;  | 
                                                        
| 61 | 61 | |
| 62 | - /**  | 
                                                        |
| 63 | - * @var Mailcode_Collection  | 
                                                        |
| 64 | - */  | 
                                                        |
| 62 | + /**  | 
                                                        |
| 63 | + * @var Mailcode_Collection  | 
                                                        |
| 64 | + */  | 
                                                        |
| 65 | 65 | private $collection;  | 
                                                        
| 66 | 66 | |
| 67 | 67 | public function __construct(Mailcode_Commands_LogicKeywords $keywords, string $name, string $matchedString, string $type)  | 
                                                        
@@ -72,10 +72,10 @@ discard block  | 
                                                    ||
| 72 | 72 | $this->matchedString = $matchedString;  | 
                                                        
| 73 | 73 | }  | 
                                                        
| 74 | 74 | |
| 75 | - /**  | 
                                                        |
| 76 | - * The keyword name, e.g. "and". Always lowercase.  | 
                                                        |
| 77 | - * @return string  | 
                                                        |
| 78 | - */  | 
                                                        |
| 75 | + /**  | 
                                                        |
| 76 | + * The keyword name, e.g. "and". Always lowercase.  | 
                                                        |
| 77 | + * @return string  | 
                                                        |
| 78 | + */  | 
                                                        |
| 79 | 79 | public function getName() : string  | 
                                                        
| 80 | 80 |      { | 
                                                        
| 81 | 81 | return $this->name;  | 
                                                        
@@ -98,24 +98,24 @@ discard block  | 
                                                    ||
| 98 | 98 | return $string;  | 
                                                        
| 99 | 99 | }  | 
                                                        
| 100 | 100 | |
| 101 | - /**  | 
                                                        |
| 102 | - * The full string that was matched in the command's parameters  | 
                                                        |
| 103 | - * string. Examples: "and:", "and variable:"...  | 
                                                        |
| 104 | - *  | 
                                                        |
| 105 | - * @return string  | 
                                                        |
| 106 | - */  | 
                                                        |
| 101 | + /**  | 
                                                        |
| 102 | + * The full string that was matched in the command's parameters  | 
                                                        |
| 103 | + * string. Examples: "and:", "and variable:"...  | 
                                                        |
| 104 | + *  | 
                                                        |
| 105 | + * @return string  | 
                                                        |
| 106 | + */  | 
                                                        |
| 107 | 107 | public function getMatchedString() : string  | 
                                                        
| 108 | 108 |      { | 
                                                        
| 109 | 109 | return $this->matchedString;  | 
                                                        
| 110 | 110 | }  | 
                                                        
| 111 | 111 | |
| 112 | - /**  | 
                                                        |
| 113 | - * Sets the parameters string matching this logic keyword,  | 
                                                        |
| 114 | - * which is used to build the actual sub-command. Set by  | 
                                                        |
| 115 | - * the LogicKeywords class instance.  | 
                                                        |
| 116 | - *  | 
                                                        |
| 117 | - * @param string $params  | 
                                                        |
| 118 | - */  | 
                                                        |
| 112 | + /**  | 
                                                        |
| 113 | + * Sets the parameters string matching this logic keyword,  | 
                                                        |
| 114 | + * which is used to build the actual sub-command. Set by  | 
                                                        |
| 115 | + * the LogicKeywords class instance.  | 
                                                        |
| 116 | + *  | 
                                                        |
| 117 | + * @param string $params  | 
                                                        |
| 118 | + */  | 
                                                        |
| 119 | 119 | public function setParamsString(string $params) : void  | 
                                                        
| 120 | 120 |      { | 
                                                        
| 121 | 121 | if($this->paramsSet)  | 
                                                        
@@ -133,13 +133,13 @@ discard block  | 
                                                    ||
| 133 | 133 | $this->createCommand();  | 
                                                        
| 134 | 134 | }  | 
                                                        
| 135 | 135 | |
| 136 | - /**  | 
                                                        |
| 137 | - * Retrieves the full command string used to create  | 
                                                        |
| 138 | - * the actual command. For opening commands like IF,  | 
                                                        |
| 139 | -    * this includes the closing {end} command. | 
                                                        |
| 140 | - *  | 
                                                        |
| 141 | - * @return string  | 
                                                        |
| 142 | - */  | 
                                                        |
| 136 | + /**  | 
                                                        |
| 137 | + * Retrieves the full command string used to create  | 
                                                        |
| 138 | + * the actual command. For opening commands like IF,  | 
                                                        |
| 139 | +     * this includes the closing {end} command. | 
                                                        |
| 140 | + *  | 
                                                        |
| 141 | + * @return string  | 
                                                        |
| 142 | + */  | 
                                                        |
| 143 | 143 | public function getCommandString() : string  | 
                                                        
| 144 | 144 |      { | 
                                                        
| 145 | 145 | $string = sprintf(  | 
                                                        
@@ -182,12 +182,12 @@ discard block  | 
                                                    ||
| 182 | 182 | }  | 
                                                        
| 183 | 183 | }  | 
                                                        
| 184 | 184 | |
| 185 | - /**  | 
                                                        |
| 186 | - * Retrieves the command for the keyword.  | 
                                                        |
| 187 | - *  | 
                                                        |
| 188 | - * @throws Mailcode_Exception  | 
                                                        |
| 189 | - * @return Mailcode_Commands_Command  | 
                                                        |
| 190 | - */  | 
                                                        |
| 185 | + /**  | 
                                                        |
| 186 | + * Retrieves the command for the keyword.  | 
                                                        |
| 187 | + *  | 
                                                        |
| 188 | + * @throws Mailcode_Exception  | 
                                                        |
| 189 | + * @return Mailcode_Commands_Command  | 
                                                        |
| 190 | + */  | 
                                                        |
| 191 | 191 | public function getCommand() : Mailcode_Commands_Command  | 
                                                        
| 192 | 192 |      { | 
                                                        
| 193 | 193 | $command = $this->collection->getFirstCommand();  | 
                                                        
@@ -20,19 +20,19 @@ discard block  | 
                                                    ||
| 20 | 20 | */  | 
                                                        
| 21 | 21 | class Mailcode_Commands_Highlighter  | 
                                                        
| 22 | 22 |  { | 
                                                        
| 23 | - /**  | 
                                                        |
| 24 | - * @var Mailcode_Commands_Command  | 
                                                        |
| 25 | - */  | 
                                                        |
| 23 | + /**  | 
                                                        |
| 24 | + * @var Mailcode_Commands_Command  | 
                                                        |
| 25 | + */  | 
                                                        |
| 26 | 26 | protected $command;  | 
                                                        
| 27 | 27 | |
| 28 | - /**  | 
                                                        |
| 29 | - * @var string[]  | 
                                                        |
| 30 | - */  | 
                                                        |
| 28 | + /**  | 
                                                        |
| 29 | + * @var string[]  | 
                                                        |
| 30 | + */  | 
                                                        |
| 31 | 31 | protected $parts = array();  | 
                                                        
| 32 | 32 | |
| 33 | 33 | public function __construct(Mailcode_Commands_Command $command)  | 
                                                        
| 34 | 34 |      { | 
                                                        
| 35 | - $this->command = $command;  | 
                                                        |
| 35 | + $this->command = $command;  | 
                                                        |
| 36 | 36 | }  | 
                                                        
| 37 | 37 | |
| 38 | 38 | public function highlight() : string  | 
                                                        
@@ -121,11 +121,11 @@ discard block  | 
                                                    ||
| 121 | 121 | $this->appendParams($keyword->getCommand());  | 
                                                        
| 122 | 122 | }  | 
                                                        
| 123 | 123 | |
| 124 | - /**  | 
                                                        |
| 125 | - * @param string[] $classes  | 
                                                        |
| 126 | - * @param string $content  | 
                                                        |
| 127 | - * @return string  | 
                                                        |
| 128 | - */  | 
                                                        |
| 124 | + /**  | 
                                                        |
| 125 | + * @param string[] $classes  | 
                                                        |
| 126 | + * @param string $content  | 
                                                        |
| 127 | + * @return string  | 
                                                        |
| 128 | + */  | 
                                                        |
| 129 | 129 | protected function renderTag(array $classes, string $content) : string  | 
                                                        
| 130 | 130 |      { | 
                                                        
| 131 | 131 | $parts = array();  | 
                                                        
@@ -52,12 +52,12 @@ discard block  | 
                                                    ||
| 52 | 52 |      { | 
                                                        
| 53 | 53 |          $this->parts[] = $this->renderTag(array('command-name'), $this->command->getName()); | 
                                                        
| 54 | 54 | |
| 55 | - if($this->command->hasType())  | 
                                                        |
| 55 | + if ($this->command->hasType())  | 
                                                        |
| 56 | 56 |          { | 
                                                        
| 57 | 57 |              $this->parts[] = ' '.$this->renderTag(array('command-type'), $this->command->getType()); | 
                                                        
| 58 | 58 | }  | 
                                                        
| 59 | 59 | |
| 60 | - if($this->command->requiresParameters())  | 
                                                        |
| 60 | + if ($this->command->requiresParameters())  | 
                                                        |
| 61 | 61 |          { | 
                                                        
| 62 | 62 |              $this->parts[] = $this->renderTag(array('hyphen'), ':'); | 
                                                        
| 63 | 63 | $this->parts[] = '<wbr>';  | 
                                                        
@@ -68,14 +68,14 @@ discard block  | 
                                                    ||
| 68 | 68 |      { | 
                                                        
| 69 | 69 | $params = $command->getParams();  | 
                                                        
| 70 | 70 | |
| 71 | - if($params === null)  | 
                                                        |
| 71 | + if ($params === null)  | 
                                                        |
| 72 | 72 |          { | 
                                                        
| 73 | 73 | return;  | 
                                                        
| 74 | 74 | }  | 
                                                        
| 75 | 75 | |
| 76 | 76 | $tokens = $params->getInfo()->getTokens();  | 
                                                        
| 77 | 77 | |
| 78 | - if(!empty($tokens))  | 
                                                        |
| 78 | + if (!empty($tokens))  | 
                                                        |
| 79 | 79 |          { | 
                                                        
| 80 | 80 | $this->parts[] = ' ';  | 
                                                        
| 81 | 81 | $this->parts[] = '<span class="mailcode-params">';  | 
                                                        
@@ -91,9 +91,9 @@ discard block  | 
                                                    ||
| 91 | 91 | }  | 
                                                        
| 92 | 92 | }  | 
                                                        
| 93 | 93 | |
| 94 | - protected function appendParamToken(Mailcode_Parser_Statement_Tokenizer_Token $token, ?Mailcode_Parser_Statement_Tokenizer_Token $previous=null) : void  | 
                                                        |
| 94 | + protected function appendParamToken(Mailcode_Parser_Statement_Tokenizer_Token $token, ?Mailcode_Parser_Statement_Tokenizer_Token $previous = null) : void  | 
                                                        |
| 95 | 95 |      { | 
                                                        
| 96 | -        if($previous && $previous->hasSpacing()) { | 
                                                        |
| 96 | +        if ($previous && $previous->hasSpacing()) { | 
                                                        |
| 97 | 97 | $this->parts[] = ' ';  | 
                                                        
| 98 | 98 | }  | 
                                                        
| 99 | 99 | |
@@ -102,14 +102,14 @@ discard block  | 
                                                    ||
| 102 | 102 | |
| 103 | 103 | protected function appendLogicKeywords() : void  | 
                                                        
| 104 | 104 |      { | 
                                                        
| 105 | - if(!$this->command->supportsLogicKeywords())  | 
                                                        |
| 105 | + if (!$this->command->supportsLogicKeywords())  | 
                                                        |
| 106 | 106 |          { | 
                                                        
| 107 | 107 | return;  | 
                                                        
| 108 | 108 | }  | 
                                                        
| 109 | 109 | |
| 110 | 110 | $keywords = $this->command->getLogicKeywords()->getKeywords();  | 
                                                        
| 111 | 111 | |
| 112 | - foreach($keywords as $keyword)  | 
                                                        |
| 112 | + foreach ($keywords as $keyword)  | 
                                                        |
| 113 | 113 |          { | 
                                                        
| 114 | 114 | $this->appendLogicKeyword($keyword);  | 
                                                        
| 115 | 115 | }  | 
                                                        
@@ -121,7 +121,7 @@ discard block  | 
                                                    ||
| 121 | 121 | |
| 122 | 122 | $type = $keyword->getType();  | 
                                                        
| 123 | 123 | |
| 124 | - if(!empty($type))  | 
                                                        |
| 124 | + if (!empty($type))  | 
                                                        |
| 125 | 125 |          { | 
                                                        
| 126 | 126 |              $this->parts[] = ' '.$this->renderTag(array('command-type'), $type); | 
                                                        
| 127 | 127 | }  | 
                                                        
@@ -140,7 +140,7 @@ discard block  | 
                                                    ||
| 140 | 140 |      { | 
                                                        
| 141 | 141 | $parts = array();  | 
                                                        
| 142 | 142 | |
| 143 | - foreach($classes as $class)  | 
                                                        |
| 143 | + foreach ($classes as $class)  | 
                                                        |
| 144 | 144 |          { | 
                                                        
| 145 | 145 | $parts[] = 'mailcode-'.$class;  | 
                                                        
| 146 | 146 | }  |