@@ -22,10 +22,10 @@ |
||
| 22 | 22 | { |
| 23 | 23 | const ERROR_NO_KEYWORD_TOKEN_FOUND = 62701; |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * The name of the keyword, with ":" appended. |
|
| 27 | - * @var string |
|
| 28 | - */ |
|
| 25 | + /** |
|
| 26 | + * The name of the keyword, with ":" appended. |
|
| 27 | + * @var string |
|
| 28 | + */ |
|
| 29 | 29 | protected $keywordName; |
| 30 | 30 | |
| 31 | 31 | public function __construct(Mailcode_Parser_Statement $statement, string $keywordName) |
@@ -22,9 +22,9 @@ |
||
| 22 | 22 | { |
| 23 | 23 | const ERROR_NO_OPERAND_TOKEN_FOUND = 62901; |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @var string |
|
| 27 | - */ |
|
| 25 | + /** |
|
| 26 | + * @var string |
|
| 27 | + */ |
|
| 28 | 28 | private $sign = ''; |
| 29 | 29 | |
| 30 | 30 | protected function getTokenClass() : string |
@@ -20,28 +20,28 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral extends Mailcode_Parser_Statement_Tokenizer_Token implements Mailcode_Parser_Statement_Tokenizer_ValueInterface |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * Retrieves the text with the surrounding quotes. |
|
| 25 | - * @return string |
|
| 26 | - */ |
|
| 23 | + /** |
|
| 24 | + * Retrieves the text with the surrounding quotes. |
|
| 25 | + * @return string |
|
| 26 | + */ |
|
| 27 | 27 | public function getNormalized() : string |
| 28 | 28 | { |
| 29 | 29 | return $this->restoreQuotes($this->matchedText); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Retrieves the text with the surrounding quotes. |
|
| 34 | - * @return string |
|
| 35 | - */ |
|
| 32 | + /** |
|
| 33 | + * Retrieves the text with the surrounding quotes. |
|
| 34 | + * @return string |
|
| 35 | + */ |
|
| 36 | 36 | public function getValue() : string |
| 37 | 37 | { |
| 38 | 38 | return $this->getNormalized(); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Retrieves the text without the surrounding quotes. |
|
| 43 | - * @return string |
|
| 44 | - */ |
|
| 41 | + /** |
|
| 42 | + * Retrieves the text without the surrounding quotes. |
|
| 43 | + * @return string |
|
| 44 | + */ |
|
| 45 | 45 | public function getText() : string |
| 46 | 46 | { |
| 47 | 47 | $quoteless = trim($this->matchedText, '"\''); |
@@ -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 | public function __construct(string $type='', string $paramsString='', string $matchedText='') |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - /** |
|
| 118 | - * @return string The ID of the command = the name of the command class file. |
|
| 119 | - */ |
|
| 117 | + /** |
|
| 118 | + * @return string The ID of the command = the name of the command class file. |
|
| 119 | + */ |
|
| 120 | 120 | public function getID() : string |
| 121 | 121 | { |
| 122 | 122 | // account for commands with types: If_Variable should still return If. |
@@ -125,14 +125,14 @@ discard block |
||
| 125 | 125 | return array_shift($tokens); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - /** |
|
| 129 | - * Sets an optional comment that is not used anywhere, but |
|
| 130 | - * can be used by the application to track why a command is |
|
| 131 | - * used somewhere. |
|
| 132 | - * |
|
| 133 | - * @param string $comment |
|
| 134 | - * @return Mailcode_Commands_Command |
|
| 135 | - */ |
|
| 128 | + /** |
|
| 129 | + * Sets an optional comment that is not used anywhere, but |
|
| 130 | + * can be used by the application to track why a command is |
|
| 131 | + * used somewhere. |
|
| 132 | + * |
|
| 133 | + * @param string $comment |
|
| 134 | + * @return Mailcode_Commands_Command |
|
| 135 | + */ |
|
| 136 | 136 | public function setComment(string $comment) : Mailcode_Commands_Command |
| 137 | 137 | { |
| 138 | 138 | $this->comment = $comment; |
@@ -140,34 +140,34 @@ discard block |
||
| 140 | 140 | return $this; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - /** |
|
| 144 | - * Retrieves the previously set comment, if any. |
|
| 145 | - * |
|
| 146 | - * @return string |
|
| 147 | - */ |
|
| 143 | + /** |
|
| 144 | + * Retrieves the previously set comment, if any. |
|
| 145 | + * |
|
| 146 | + * @return string |
|
| 147 | + */ |
|
| 148 | 148 | public function getComment() : string |
| 149 | 149 | { |
| 150 | 150 | return $this->comment; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - /** |
|
| 154 | - * Checks whether this is a dummy command, which is only |
|
| 155 | - * used to access information on the command type. It cannot |
|
| 156 | - * be used as an actual live command. |
|
| 157 | - * |
|
| 158 | - * @return bool |
|
| 159 | - */ |
|
| 153 | + /** |
|
| 154 | + * Checks whether this is a dummy command, which is only |
|
| 155 | + * used to access information on the command type. It cannot |
|
| 156 | + * be used as an actual live command. |
|
| 157 | + * |
|
| 158 | + * @return bool |
|
| 159 | + */ |
|
| 160 | 160 | public function isDummy() : bool |
| 161 | 161 | { |
| 162 | 162 | return $this->type === '__dummy'; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - /** |
|
| 166 | - * Retrieves a hash of the actual matched command string, |
|
| 167 | - * which is used in collections to detect duplicate commands. |
|
| 168 | - * |
|
| 169 | - * @return string |
|
| 170 | - */ |
|
| 165 | + /** |
|
| 166 | + * Retrieves a hash of the actual matched command string, |
|
| 167 | + * which is used in collections to detect duplicate commands. |
|
| 168 | + * |
|
| 169 | + * @return string |
|
| 170 | + */ |
|
| 171 | 171 | public function getHash() : string |
| 172 | 172 | { |
| 173 | 173 | $this->requireNonDummy(); |
@@ -261,9 +261,9 @@ discard block |
||
| 261 | 261 | return $this->validationResult->isValid(); |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - /** |
|
| 265 | - * @return string[] |
|
| 266 | - */ |
|
| 264 | + /** |
|
| 265 | + * @return string[] |
|
| 266 | + */ |
|
| 267 | 267 | abstract protected function getValidations() : array; |
| 268 | 268 | |
| 269 | 269 | protected function validateSyntax_params_empty() : void |
@@ -422,12 +422,12 @@ discard block |
||
| 422 | 422 | |
| 423 | 423 | abstract public function supportsType() : bool; |
| 424 | 424 | |
| 425 | - /** |
|
| 426 | - * Whether the command allows using logic keywords like "and:" or "or:" |
|
| 427 | - * in the command parameters. |
|
| 428 | - * |
|
| 429 | - * @return bool |
|
| 430 | - */ |
|
| 425 | + /** |
|
| 426 | + * Whether the command allows using logic keywords like "and:" or "or:" |
|
| 427 | + * in the command parameters. |
|
| 428 | + * |
|
| 429 | + * @return bool |
|
| 430 | + */ |
|
| 431 | 431 | abstract public function supportsLogicKeywords() : bool; |
| 432 | 432 | |
| 433 | 433 | abstract public function generatesContent() : bool; |
@@ -473,22 +473,22 @@ discard block |
||
| 473 | 473 | return $normalizer->normalize(); |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | - /** |
|
| 477 | - * Retrieves the names of all the command's supported types: the part |
|
| 478 | - * between the command name and the colon. Example: {command type: params}. |
|
| 479 | - * |
|
| 480 | - * @return string[] |
|
| 481 | - */ |
|
| 476 | + /** |
|
| 477 | + * Retrieves the names of all the command's supported types: the part |
|
| 478 | + * between the command name and the colon. Example: {command type: params}. |
|
| 479 | + * |
|
| 480 | + * @return string[] |
|
| 481 | + */ |
|
| 482 | 482 | public function getSupportedTypes() : array |
| 483 | 483 | { |
| 484 | 484 | return array(); |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | - /** |
|
| 488 | - * Retrieves all variable names used in the command. |
|
| 489 | - * |
|
| 490 | - * @return Mailcode_Variables_Collection_Regular |
|
| 491 | - */ |
|
| 487 | + /** |
|
| 488 | + * Retrieves all variable names used in the command. |
|
| 489 | + * |
|
| 490 | + * @return Mailcode_Variables_Collection_Regular |
|
| 491 | + */ |
|
| 492 | 492 | public function getVariables() : Mailcode_Variables_Collection_Regular |
| 493 | 493 | { |
| 494 | 494 | return Mailcode::create()->findVariables($this->paramsString); |
@@ -20,9 +20,9 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | class Mailcode_Commands_Command_SetVariable extends Mailcode_Commands_Command implements Mailcode_Commands_Command_Type_Standalone |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
| 25 | - */ |
|
| 23 | + /** |
|
| 24 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
| 25 | + */ |
|
| 26 | 26 | private $variableToken; |
| 27 | 27 | |
| 28 | 28 | public function getName() : string |
@@ -126,9 +126,9 @@ discard block |
||
| 126 | 126 | ); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - /** |
|
| 130 | - * @return Mailcode_Parser_Statement_Tokenizer_Token[] |
|
| 131 | - */ |
|
| 129 | + /** |
|
| 130 | + * @return Mailcode_Parser_Statement_Tokenizer_Token[] |
|
| 131 | + */ |
|
| 132 | 132 | public function getAssignmentTokens() : array |
| 133 | 133 | { |
| 134 | 134 | $params = $this->params->getInfo()->getTokens(); |
@@ -36,9 +36,9 @@ |
||
| 36 | 36 | ); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @return array<string> |
|
| 41 | - */ |
|
| 39 | + /** |
|
| 40 | + * @return array<string> |
|
| 41 | + */ |
|
| 42 | 42 | protected function getAllowedOperands() : array |
| 43 | 43 | { |
| 44 | 44 | return Mailcode_Parser_Statement_Tokenizer_Token_Operand::getComparisonSigns(); |
@@ -24,9 +24,9 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | trait Mailcode_Traits_Commands_Validation_Value |
| 26 | 26 | { |
| 27 | - /** |
|
| 28 | - * @var Mailcode_Parser_Statement_Tokenizer_ValueInterface|NULL |
|
| 29 | - */ |
|
| 27 | + /** |
|
| 28 | + * @var Mailcode_Parser_Statement_Tokenizer_ValueInterface|NULL |
|
| 29 | + */ |
|
| 30 | 30 | protected $valueToken; |
| 31 | 31 | |
| 32 | 32 | protected function validateSyntax_value() : void |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * Retrieves the variable being compared. |
|
| 51 | - * |
|
| 52 | - * @return string |
|
| 53 | - */ |
|
| 49 | + /** |
|
| 50 | + * Retrieves the variable being compared. |
|
| 51 | + * |
|
| 52 | + * @return string |
|
| 53 | + */ |
|
| 54 | 54 | public function getValue() : string |
| 55 | 55 | { |
| 56 | 56 | if($this->valueToken instanceof Mailcode_Parser_Statement_Tokenizer_ValueInterface) |
@@ -25,14 +25,14 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | trait Mailcode_Traits_Commands_Validation_Operand |
| 27 | 27 | { |
| 28 | - /** |
|
| 29 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Operand|NULL |
|
| 30 | - */ |
|
| 28 | + /** |
|
| 29 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Operand|NULL |
|
| 30 | + */ |
|
| 31 | 31 | protected $operandToken; |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * @return string[] |
|
| 35 | - */ |
|
| 33 | + /** |
|
| 34 | + * @return string[] |
|
| 35 | + */ |
|
| 36 | 36 | abstract protected function getAllowedOperands() : array; |
| 37 | 37 | |
| 38 | 38 | protected function validateSyntax_operand() : void |
@@ -78,11 +78,11 @@ discard block |
||
| 78 | 78 | ); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Retrieves the operand sign. |
|
| 83 | - * |
|
| 84 | - * @return string |
|
| 85 | - */ |
|
| 81 | + /** |
|
| 82 | + * Retrieves the operand sign. |
|
| 83 | + * |
|
| 84 | + * @return string |
|
| 85 | + */ |
|
| 86 | 86 | public function getSign() : string |
| 87 | 87 | { |
| 88 | 88 | return $this->getOperand()->getSign(); |
@@ -24,9 +24,9 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | trait Mailcode_Traits_Commands_Validation_Variable |
| 26 | 26 | { |
| 27 | - /** |
|
| 28 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
| 29 | - */ |
|
| 27 | + /** |
|
| 28 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
| 29 | + */ |
|
| 30 | 30 | protected $variableToken; |
| 31 | 31 | |
| 32 | 32 | protected function validateSyntax_variable() : void |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * Retrieves the variable being compared. |
|
| 51 | - * |
|
| 52 | - * @return Mailcode_Variables_Variable |
|
| 53 | - */ |
|
| 49 | + /** |
|
| 50 | + * Retrieves the variable being compared. |
|
| 51 | + * |
|
| 52 | + * @return Mailcode_Variables_Variable |
|
| 53 | + */ |
|
| 54 | 54 | public function getVariable() : Mailcode_Variables_Variable |
| 55 | 55 | { |
| 56 | 56 | if($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |