@@ -24,9 +24,9 @@ |
||
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 |
@@ -36,44 +36,44 @@ discard block |
||
36 | 36 | |
37 | 37 | const META_URL_ENCODING = 'url_encoding'; |
38 | 38 | |
39 | - /** |
|
40 | - * @var string |
|
41 | - */ |
|
39 | + /** |
|
40 | + * @var string |
|
41 | + */ |
|
42 | 42 | protected $type = ''; |
43 | 43 | |
44 | - /** |
|
45 | - * @var string |
|
46 | - */ |
|
44 | + /** |
|
45 | + * @var string |
|
46 | + */ |
|
47 | 47 | protected $paramsString = ''; |
48 | 48 | |
49 | - /** |
|
50 | - * @var string |
|
51 | - */ |
|
49 | + /** |
|
50 | + * @var string |
|
51 | + */ |
|
52 | 52 | protected $matchedText = ''; |
53 | 53 | |
54 | - /** |
|
55 | - * @var string |
|
56 | - */ |
|
54 | + /** |
|
55 | + * @var string |
|
56 | + */ |
|
57 | 57 | protected $hash = ''; |
58 | 58 | |
59 | - /** |
|
60 | - * @var OperationResult |
|
61 | - */ |
|
59 | + /** |
|
60 | + * @var OperationResult |
|
61 | + */ |
|
62 | 62 | protected $validationResult = null; |
63 | 63 | |
64 | - /** |
|
65 | - * @var \Mailcode\Mailcode |
|
66 | - */ |
|
64 | + /** |
|
65 | + * @var \Mailcode\Mailcode |
|
66 | + */ |
|
67 | 67 | protected $mailcode; |
68 | 68 | |
69 | - /** |
|
70 | - * @var \Mailcode\Mailcode_Parser_Statement |
|
71 | - */ |
|
69 | + /** |
|
70 | + * @var \Mailcode\Mailcode_Parser_Statement |
|
71 | + */ |
|
72 | 72 | protected $params; |
73 | 73 | |
74 | - /** |
|
75 | - * @var string[] |
|
76 | - */ |
|
74 | + /** |
|
75 | + * @var string[] |
|
76 | + */ |
|
77 | 77 | protected $validations = array( |
78 | 78 | 'params_empty', |
79 | 79 | 'params_keywords', |
@@ -82,24 +82,24 @@ discard block |
||
82 | 82 | 'type_unsupported' |
83 | 83 | ); |
84 | 84 | |
85 | - /** |
|
86 | - * @var string |
|
87 | - */ |
|
85 | + /** |
|
86 | + * @var string |
|
87 | + */ |
|
88 | 88 | protected $comment = ''; |
89 | 89 | |
90 | - /** |
|
91 | - * @var Mailcode_Commands_LogicKeywords|NULL |
|
92 | - */ |
|
90 | + /** |
|
91 | + * @var Mailcode_Commands_LogicKeywords|NULL |
|
92 | + */ |
|
93 | 93 | protected $logicKeywords; |
94 | 94 | |
95 | - /** |
|
96 | - * @var Mailcode_Parser_Statement_Validator |
|
97 | - */ |
|
95 | + /** |
|
96 | + * @var Mailcode_Parser_Statement_Validator |
|
97 | + */ |
|
98 | 98 | protected $validator; |
99 | 99 | |
100 | - /** |
|
101 | - * @var boolean |
|
102 | - */ |
|
100 | + /** |
|
101 | + * @var boolean |
|
102 | + */ |
|
103 | 103 | private $validated = false; |
104 | 104 | |
105 | 105 | /** |
@@ -134,13 +134,13 @@ discard block |
||
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | - /** |
|
138 | - * Sets the command's parent opening command, if any. |
|
139 | - * NOTE: This is set automatically by the parser, and |
|
140 | - * should not be called manually. |
|
141 | - * |
|
142 | - * @param Mailcode_Commands_Command $command |
|
143 | - */ |
|
137 | + /** |
|
138 | + * Sets the command's parent opening command, if any. |
|
139 | + * NOTE: This is set automatically by the parser, and |
|
140 | + * should not be called manually. |
|
141 | + * |
|
142 | + * @param Mailcode_Commands_Command $command |
|
143 | + */ |
|
144 | 144 | public function setParent(Mailcode_Commands_Command $command) : void |
145 | 145 | { |
146 | 146 | $this->parent = $command; |
@@ -282,9 +282,9 @@ discard block |
||
282 | 282 | return $this->validationResult->isValid(); |
283 | 283 | } |
284 | 284 | |
285 | - /** |
|
286 | - * @return string[] |
|
287 | - */ |
|
285 | + /** |
|
286 | + * @return string[] |
|
287 | + */ |
|
288 | 288 | abstract protected function getValidations() : array; |
289 | 289 | |
290 | 290 | protected function _validateNesting() : void |
@@ -31,19 +31,19 @@ |
||
31 | 31 | const VALIDATION_VARIABLE_NAME_WITH_DOT = 49704; |
32 | 32 | const VALIDATION_LOOP_VARIABLE_NAME_WITH_DOT = 49705; |
33 | 33 | |
34 | - /** |
|
35 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
36 | - */ |
|
34 | + /** |
|
35 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
36 | + */ |
|
37 | 37 | private $loopVar; |
38 | 38 | |
39 | - /** |
|
40 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
41 | - */ |
|
39 | + /** |
|
40 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
41 | + */ |
|
42 | 42 | private $sourceVar; |
43 | 43 | |
44 | - /** |
|
45 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL |
|
46 | - */ |
|
44 | + /** |
|
45 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL |
|
46 | + */ |
|
47 | 47 | private $keyword; |
48 | 48 | |
49 | 49 | public function getName() : string |
@@ -23,25 +23,25 @@ discard block |
||
23 | 23 | */ |
24 | 24 | trait Mailcode_Traits_Formatting_HTMLHighlighting |
25 | 25 | { |
26 | - /** |
|
27 | - * Stored this way so we can use isset() instead |
|
28 | - * of using in_array, which is some magnitudes slower. |
|
29 | - * The boolean value is not used otherwise. |
|
30 | - * |
|
31 | - * @var array<string,bool> |
|
32 | - */ |
|
26 | + /** |
|
27 | + * Stored this way so we can use isset() instead |
|
28 | + * of using in_array, which is some magnitudes slower. |
|
29 | + * The boolean value is not used otherwise. |
|
30 | + * |
|
31 | + * @var array<string,bool> |
|
32 | + */ |
|
33 | 33 | private $excludeTags = array( |
34 | 34 | 'style' => true, // NOTE: style tags are excluded natively on the parser level. |
35 | 35 | 'script' => true |
36 | 36 | ); |
37 | 37 | |
38 | - /** |
|
39 | - * Adds an HTML tag name to the list of tags within which |
|
40 | - * commands may not be highlighted. |
|
41 | - * |
|
42 | - * @param string $tagName Case insensitive. |
|
43 | - * @return $this |
|
44 | - */ |
|
38 | + /** |
|
39 | + * Adds an HTML tag name to the list of tags within which |
|
40 | + * commands may not be highlighted. |
|
41 | + * |
|
42 | + * @param string $tagName Case insensitive. |
|
43 | + * @return $this |
|
44 | + */ |
|
45 | 45 | public function excludeTag(string $tagName) |
46 | 46 | { |
47 | 47 | $tagName = strtolower($tagName); |
@@ -51,12 +51,12 @@ discard block |
||
51 | 51 | return $this; |
52 | 52 | } |
53 | 53 | |
54 | - /** |
|
55 | - * Adds several exluded tag names at once. |
|
56 | - * |
|
57 | - * @param string[] $tagNames |
|
58 | - * @return $this |
|
59 | - */ |
|
54 | + /** |
|
55 | + * Adds several exluded tag names at once. |
|
56 | + * |
|
57 | + * @param string[] $tagNames |
|
58 | + * @return $this |
|
59 | + */ |
|
60 | 60 | public function excludeTags(array $tagNames) |
61 | 61 | { |
62 | 62 | foreach($tagNames as $tagName) |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | return $this; |
68 | 68 | } |
69 | 69 | |
70 | - /** |
|
71 | - * Whether the specified tag name is in the exlusion list. |
|
72 | - * |
|
73 | - * @param string $tagName |
|
74 | - * @return bool |
|
75 | - */ |
|
70 | + /** |
|
71 | + * Whether the specified tag name is in the exlusion list. |
|
72 | + * |
|
73 | + * @param string $tagName |
|
74 | + * @return bool |
|
75 | + */ |
|
76 | 76 | public function isTagExcluded(string $tagName) : bool |
77 | 77 | { |
78 | 78 | $tagName = strtolower($tagName); |
@@ -26,14 +26,14 @@ |
||
26 | 26 | */ |
27 | 27 | trait Mailcode_Traits_Commands_Validation_CaseSensitive |
28 | 28 | { |
29 | - /** |
|
30 | - * @var boolean |
|
31 | - */ |
|
29 | + /** |
|
30 | + * @var boolean |
|
31 | + */ |
|
32 | 32 | protected $caseInsensitive = false; |
33 | 33 | |
34 | - /** |
|
35 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL |
|
36 | - */ |
|
34 | + /** |
|
35 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL |
|
36 | + */ |
|
37 | 37 | protected $regexToken; |
38 | 38 | |
39 | 39 | protected function validateSyntax_case_sensitive() : void |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | */ |
29 | 29 | class Mailcode_Parser_Statement_Validator |
30 | 30 | { |
31 | - /** |
|
32 | - * @var Mailcode_Parser_Statement |
|
33 | - */ |
|
31 | + /** |
|
32 | + * @var Mailcode_Parser_Statement |
|
33 | + */ |
|
34 | 34 | private $statement; |
35 | 35 | |
36 | 36 | public function __construct(Mailcode_Parser_Statement $statement) |
@@ -38,24 +38,24 @@ discard block |
||
38 | 38 | $this->statement = $statement; |
39 | 39 | } |
40 | 40 | |
41 | - /** |
|
42 | - * Creates a variable validator: checks whether a single |
|
43 | - * variable token is present in the parameters. |
|
44 | - * |
|
45 | - * @return Mailcode_Parser_Statement_Validator_Type_Variable |
|
46 | - */ |
|
41 | + /** |
|
42 | + * Creates a variable validator: checks whether a single |
|
43 | + * variable token is present in the parameters. |
|
44 | + * |
|
45 | + * @return Mailcode_Parser_Statement_Validator_Type_Variable |
|
46 | + */ |
|
47 | 47 | public function createVariable() : Mailcode_Parser_Statement_Validator_Type_Variable |
48 | 48 | { |
49 | 49 | return new Mailcode_Parser_Statement_Validator_Type_Variable($this->statement); |
50 | 50 | } |
51 | 51 | |
52 | - /** |
|
53 | - * Creates a keyword validator: checks whether a single |
|
54 | - * keyword token is present in the parameters. |
|
55 | - * |
|
56 | - * @param string $keywordName |
|
57 | - * @return Mailcode_Parser_Statement_Validator_Type_Keyword |
|
58 | - */ |
|
52 | + /** |
|
53 | + * Creates a keyword validator: checks whether a single |
|
54 | + * keyword token is present in the parameters. |
|
55 | + * |
|
56 | + * @param string $keywordName |
|
57 | + * @return Mailcode_Parser_Statement_Validator_Type_Keyword |
|
58 | + */ |
|
59 | 59 | public function createKeyword(string $keywordName) : Mailcode_Parser_Statement_Validator_Type_Keyword |
60 | 60 | { |
61 | 61 | return new Mailcode_Parser_Statement_Validator_Type_Keyword( |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | const ERROR_CANNOT_RETRIEVE_FIRST_ERROR = 52301; |
26 | 26 | const ERROR_CANNOT_MODIFY_FINALIZED = 52302; |
27 | 27 | |
28 | - /** |
|
29 | - * @var Mailcode_Commands_Command[] |
|
30 | - */ |
|
28 | + /** |
|
29 | + * @var Mailcode_Commands_Command[] |
|
30 | + */ |
|
31 | 31 | protected $commands = array(); |
32 | 32 | |
33 | 33 | /** |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | */ |
36 | 36 | protected $errors = array(); |
37 | 37 | |
38 | - /** |
|
39 | - * @var OperationResult|NULL |
|
40 | - */ |
|
38 | + /** |
|
39 | + * @var OperationResult|NULL |
|
40 | + */ |
|
41 | 41 | protected $validationResult; |
42 | 42 | |
43 | 43 | /** |
@@ -77,21 +77,21 @@ discard block |
||
77 | 77 | return $this; |
78 | 78 | } |
79 | 79 | |
80 | - /** |
|
81 | - * Whether there are any commands in the collection. |
|
82 | - * |
|
83 | - * @return bool |
|
84 | - */ |
|
80 | + /** |
|
81 | + * Whether there are any commands in the collection. |
|
82 | + * |
|
83 | + * @return bool |
|
84 | + */ |
|
85 | 85 | public function hasCommands() : bool |
86 | 86 | { |
87 | 87 | return !empty($this->commands); |
88 | 88 | } |
89 | 89 | |
90 | - /** |
|
91 | - * Counts the amount of commands in the collection. |
|
92 | - * |
|
93 | - * @return int |
|
94 | - */ |
|
90 | + /** |
|
91 | + * Counts the amount of commands in the collection. |
|
92 | + * |
|
93 | + * @return int |
|
94 | + */ |
|
95 | 95 | public function countCommands() : int |
96 | 96 | { |
97 | 97 | return count($this->commands); |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | $this->commands = $keep; |
130 | 130 | } |
131 | 131 | |
132 | - /** |
|
133 | - * @return Mailcode_Collection_Error[] |
|
134 | - */ |
|
132 | + /** |
|
133 | + * @return Mailcode_Collection_Error[] |
|
134 | + */ |
|
135 | 135 | public function getErrors() |
136 | 136 | { |
137 | 137 | $result = $this->getValidationResult(); |
@@ -173,12 +173,12 @@ discard block |
||
173 | 173 | return empty($errors); |
174 | 174 | } |
175 | 175 | |
176 | - /** |
|
177 | - * Retrieves all commands that were detected, in the exact order |
|
178 | - * they were found. |
|
179 | - * |
|
180 | - * @return Mailcode_Commands_Command[] |
|
181 | - */ |
|
176 | + /** |
|
177 | + * Retrieves all commands that were detected, in the exact order |
|
178 | + * they were found. |
|
179 | + * |
|
180 | + * @return Mailcode_Commands_Command[] |
|
181 | + */ |
|
182 | 182 | public function getCommands() |
183 | 183 | { |
184 | 184 | $this->validate(); |
@@ -329,10 +329,10 @@ discard block |
||
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
332 | - * Retrieves only show variable commands in the collection, if any. |
|
333 | - * |
|
334 | - * @return Mailcode_Commands_Command_ShowVariable[] |
|
335 | - */ |
|
332 | + * Retrieves only show variable commands in the collection, if any. |
|
333 | + * |
|
334 | + * @return Mailcode_Commands_Command_ShowVariable[] |
|
335 | + */ |
|
336 | 336 | public function getShowVariableCommands(): array |
337 | 337 | { |
338 | 338 | return $this->getCommandsByClass(Mailcode_Commands_Command_ShowVariable::class); |
@@ -346,11 +346,11 @@ discard block |
||
346 | 346 | return $this->getCommandsByClass(Mailcode_Commands_Command_For::class); |
347 | 347 | } |
348 | 348 | |
349 | - /** |
|
350 | - * Retrieves only show date commands in the collection, if any. |
|
351 | - * |
|
352 | - * @return Mailcode_Commands_Command_ShowDate[] |
|
353 | - */ |
|
349 | + /** |
|
350 | + * Retrieves only show date commands in the collection, if any. |
|
351 | + * |
|
352 | + * @return Mailcode_Commands_Command_ShowDate[] |
|
353 | + */ |
|
354 | 354 | public function getShowDateCommands() : array |
355 | 355 | { |
356 | 356 | return $this->getCommandsByClass(Mailcode_Commands_Command_ShowDate::class); |
@@ -26,14 +26,14 @@ |
||
26 | 26 | */ |
27 | 27 | trait Mailcode_Traits_Commands_Validation_Multiline |
28 | 28 | { |
29 | - /** |
|
30 | - * @var boolean |
|
31 | - */ |
|
29 | + /** |
|
30 | + * @var boolean |
|
31 | + */ |
|
32 | 32 | protected $multiline = false; |
33 | 33 | |
34 | - /** |
|
35 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL |
|
36 | - */ |
|
34 | + /** |
|
35 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL |
|
36 | + */ |
|
37 | 37 | protected $multilineToken; |
38 | 38 | |
39 | 39 | protected function validateSyntax_multiline() : void |
@@ -30,19 +30,19 @@ |
||
30 | 30 | const VALIDATION_UNCLOSED_COMMAND = 49104; |
31 | 31 | const VALIDATION_CLOSING_NON_OPENING_COMMAND = 49105; |
32 | 32 | |
33 | - /** |
|
34 | - * @var Mailcode_Collection |
|
35 | - */ |
|
33 | + /** |
|
34 | + * @var Mailcode_Collection |
|
35 | + */ |
|
36 | 36 | protected $collection; |
37 | 37 | |
38 | - /** |
|
39 | - * @var OperationResult |
|
40 | - */ |
|
38 | + /** |
|
39 | + * @var OperationResult |
|
40 | + */ |
|
41 | 41 | protected $validationResult; |
42 | 42 | |
43 | - /** |
|
44 | - * @var Mailcode_Commands_Command_Type[] |
|
45 | - */ |
|
43 | + /** |
|
44 | + * @var Mailcode_Commands_Command_Type[] |
|
45 | + */ |
|
46 | 46 | protected $stack = array(); |
47 | 47 | |
48 | 48 | public function __construct(Mailcode_Collection $collection) |