@@ -22,53 +22,53 @@ discard block |
||
22 | 22 | { |
23 | 23 | public const VALIDATION_ERROR_COMMAND_WITHOUT_PARAMETERS = 62401; |
24 | 24 | |
25 | - /** |
|
26 | - * @var integer |
|
27 | - */ |
|
25 | + /** |
|
26 | + * @var integer |
|
27 | + */ |
|
28 | 28 | protected $searchIndex = -1; |
29 | 29 | |
30 | - /** |
|
31 | - * @var Mailcode_Parser_Statement_Tokenizer_Token|NULL |
|
32 | - */ |
|
30 | + /** |
|
31 | + * @var Mailcode_Parser_Statement_Tokenizer_Token|NULL |
|
32 | + */ |
|
33 | 33 | protected $token; |
34 | 34 | |
35 | - /** |
|
36 | - * Retrieves the class name of the token type to |
|
37 | - * limit the token search to. Only a token of this |
|
38 | - * type will be stored. |
|
39 | - * |
|
40 | - * @return string |
|
41 | - */ |
|
35 | + /** |
|
36 | + * Retrieves the class name of the token type to |
|
37 | + * limit the token search to. Only a token of this |
|
38 | + * type will be stored. |
|
39 | + * |
|
40 | + * @return string |
|
41 | + */ |
|
42 | 42 | abstract protected function getTokenClass() : string; |
43 | 43 | |
44 | - /** |
|
45 | - * Allows the validator to apply custom search |
|
46 | - * criteria to the tokens that are searched |
|
47 | - * through to find the target token. |
|
48 | - * |
|
49 | - * NOTE: Should return true if there are no |
|
50 | - * custom criteria to apply. |
|
51 | - * |
|
52 | - * @param Mailcode_Parser_Statement_Tokenizer_Token $token |
|
53 | - * @return bool |
|
54 | - */ |
|
44 | + /** |
|
45 | + * Allows the validator to apply custom search |
|
46 | + * criteria to the tokens that are searched |
|
47 | + * through to find the target token. |
|
48 | + * |
|
49 | + * NOTE: Should return true if there are no |
|
50 | + * custom criteria to apply. |
|
51 | + * |
|
52 | + * @param Mailcode_Parser_Statement_Tokenizer_Token $token |
|
53 | + * @return bool |
|
54 | + */ |
|
55 | 55 | abstract protected function _isMatch(Mailcode_Parser_Statement_Tokenizer_Token $token) : bool; |
56 | 56 | |
57 | - /** |
|
58 | - * @return Mailcode_Parser_Statement_Tokenizer_Token |
|
59 | - */ |
|
57 | + /** |
|
58 | + * @return Mailcode_Parser_Statement_Tokenizer_Token |
|
59 | + */ |
|
60 | 60 | abstract public function getToken(); |
61 | 61 | |
62 | - /** |
|
63 | - * Checks if the specified token matches the current |
|
64 | - * search criteria (index, type...). If the token is |
|
65 | - * a match, the `_isMatch()` method is called to allow |
|
66 | - * the validator class to apply some custom criteria. |
|
67 | - * |
|
68 | - * @param Mailcode_Parser_Statement_Tokenizer_Token $token |
|
69 | - * @param int $index |
|
70 | - * @return bool |
|
71 | - */ |
|
62 | + /** |
|
63 | + * Checks if the specified token matches the current |
|
64 | + * search criteria (index, type...). If the token is |
|
65 | + * a match, the `_isMatch()` method is called to allow |
|
66 | + * the validator class to apply some custom criteria. |
|
67 | + * |
|
68 | + * @param Mailcode_Parser_Statement_Tokenizer_Token $token |
|
69 | + * @param int $index |
|
70 | + * @return bool |
|
71 | + */ |
|
72 | 72 | protected function isMatch(Mailcode_Parser_Statement_Tokenizer_Token $token, int $index) : bool |
73 | 73 | { |
74 | 74 | // filter out tokens of other types |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | return $this->_isMatch($token); |
86 | 86 | } |
87 | 87 | |
88 | - /** |
|
89 | - * Attempts to find a token in the statement |
|
90 | - * that matches the current criteria, and the |
|
91 | - * first one it finds is returned. |
|
92 | - * |
|
93 | - * @return Mailcode_Parser_Statement_Tokenizer_Token|NULL |
|
94 | - */ |
|
88 | + /** |
|
89 | + * Attempts to find a token in the statement |
|
90 | + * that matches the current criteria, and the |
|
91 | + * first one it finds is returned. |
|
92 | + * |
|
93 | + * @return Mailcode_Parser_Statement_Tokenizer_Token|NULL |
|
94 | + */ |
|
95 | 95 | protected function findToken() : ?Mailcode_Parser_Statement_Tokenizer_Token |
96 | 96 | { |
97 | 97 | $tokens = $this->params->getTokens(); |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | return false; |
121 | 121 | } |
122 | 122 | |
123 | - /** |
|
124 | - * Searches for a specific token index. |
|
125 | - * |
|
126 | - * NOTE: only relevant when trying to find a single token. |
|
127 | - * |
|
128 | - * @param int $index |
|
129 | - * @return $this |
|
130 | - */ |
|
123 | + /** |
|
124 | + * Searches for a specific token index. |
|
125 | + * |
|
126 | + * NOTE: only relevant when trying to find a single token. |
|
127 | + * |
|
128 | + * @param int $index |
|
129 | + * @return $this |
|
130 | + */ |
|
131 | 131 | public function setIndex(int $index) : Mailcode_Parser_Statement_Validator_TokenType |
132 | 132 | { |
133 | 133 | $this->searchIndex = $index; |
@@ -22,9 +22,9 @@ |
||
22 | 22 | { |
23 | 23 | public 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 |
@@ -22,10 +22,10 @@ |
||
22 | 22 | { |
23 | 23 | public 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) |
@@ -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,24 +31,24 @@ discard block |
||
31 | 31 | public const CHARTYPE_TIME = 'time'; |
32 | 32 | public const CHARTYPE_PUNCTUATION = 'punctuation'; |
33 | 33 | |
34 | - /** |
|
35 | - * @var string |
|
36 | - */ |
|
34 | + /** |
|
35 | + * @var string |
|
36 | + */ |
|
37 | 37 | private $defaultFormat = "Y/m/d"; |
38 | 38 | |
39 | - /** |
|
40 | - * @var Mailcode_Date_FormatInfo_Character[] |
|
41 | - */ |
|
39 | + /** |
|
40 | + * @var Mailcode_Date_FormatInfo_Character[] |
|
41 | + */ |
|
42 | 42 | private $formatChars = array(); |
43 | 43 | |
44 | - /** |
|
45 | - * @var string[] |
|
46 | - */ |
|
44 | + /** |
|
45 | + * @var string[] |
|
46 | + */ |
|
47 | 47 | private $allowedChars = array(); |
48 | 48 | |
49 | - /** |
|
50 | - * @var Mailcode_Date_FormatInfo|NULL |
|
51 | - */ |
|
49 | + /** |
|
50 | + * @var Mailcode_Date_FormatInfo|NULL |
|
51 | + */ |
|
52 | 52 | private static $instance; |
53 | 53 | |
54 | 54 | private function __construct() |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | return self::$instance; |
67 | 67 | } |
68 | 68 | |
69 | - /** |
|
70 | - * Initialized the list of allowed date formatting |
|
71 | - * characters. This is done only once per request |
|
72 | - * by storing them statically for performance reasons. |
|
73 | - */ |
|
69 | + /** |
|
70 | + * Initialized the list of allowed date formatting |
|
71 | + * characters. This is done only once per request |
|
72 | + * by storing them statically for performance reasons. |
|
73 | + */ |
|
74 | 74 | private function initCharacters() : void |
75 | 75 | { |
76 | 76 | $chars = array( |
@@ -115,16 +115,16 @@ discard block |
||
115 | 115 | $this->defaultFormat = $formatString; |
116 | 116 | } |
117 | 117 | |
118 | - /** |
|
119 | - * Validates the date format string, by ensuring that |
|
120 | - * all the characters it is composed of are known. |
|
121 | - * |
|
122 | - * @param string $formatString |
|
123 | - * @return OperationResult |
|
124 | - * |
|
125 | - * @see Mailcode_Commands_Command_ShowDate::VALIDATION_EMPTY_FORMAT_STRING |
|
126 | - * @see Mailcode_Commands_Command_ShowDate::VALIDATION_INVALID_FORMAT_CHARACTER |
|
127 | - */ |
|
118 | + /** |
|
119 | + * Validates the date format string, by ensuring that |
|
120 | + * all the characters it is composed of are known. |
|
121 | + * |
|
122 | + * @param string $formatString |
|
123 | + * @return OperationResult |
|
124 | + * |
|
125 | + * @see Mailcode_Commands_Command_ShowDate::VALIDATION_EMPTY_FORMAT_STRING |
|
126 | + * @see Mailcode_Commands_Command_ShowDate::VALIDATION_INVALID_FORMAT_CHARACTER |
|
127 | + */ |
|
128 | 128 | public function validateFormat(string $formatString) : OperationResult |
129 | 129 | { |
130 | 130 | $result = new OperationResult($this); |
@@ -163,23 +163,23 @@ discard block |
||
163 | 163 | return $result; |
164 | 164 | } |
165 | 165 | |
166 | - /** |
|
167 | - * Retrieves all characters that are allowed to |
|
168 | - * be used in a date format string, with information |
|
169 | - * on each. |
|
170 | - * |
|
171 | - * @return Mailcode_Date_FormatInfo_Character[] |
|
172 | - */ |
|
166 | + /** |
|
167 | + * Retrieves all characters that are allowed to |
|
168 | + * be used in a date format string, with information |
|
169 | + * on each. |
|
170 | + * |
|
171 | + * @return Mailcode_Date_FormatInfo_Character[] |
|
172 | + */ |
|
173 | 173 | public function getCharactersList() : array |
174 | 174 | { |
175 | 175 | return $this->formatChars; |
176 | 176 | } |
177 | 177 | |
178 | - /** |
|
179 | - * Retrieves the characters list, grouped by type label. |
|
180 | - * |
|
181 | - * @return array<string, array> |
|
182 | - */ |
|
178 | + /** |
|
179 | + * Retrieves the characters list, grouped by type label. |
|
180 | + * |
|
181 | + * @return array<string, array> |
|
182 | + */ |
|
183 | 183 | public function getCharactersGrouped() : array |
184 | 184 | { |
185 | 185 | $grouped = array(); |
@@ -31,27 +31,27 @@ discard block |
||
31 | 31 | public const VALIDATION_CANNOT_MIX_LOGIC_KEYWORDS = 60701; |
32 | 32 | public const VALIDATION_INVALID_SUB_COMMAND = 60702; |
33 | 33 | |
34 | - /** |
|
35 | - * @var string |
|
36 | - */ |
|
34 | + /** |
|
35 | + * @var string |
|
36 | + */ |
|
37 | 37 | private $paramsString; |
38 | 38 | |
39 | - /** |
|
40 | - * @var string[] |
|
41 | - */ |
|
39 | + /** |
|
40 | + * @var string[] |
|
41 | + */ |
|
42 | 42 | private $names = array( |
43 | 43 | 'and', |
44 | 44 | 'or' |
45 | 45 | ); |
46 | 46 | |
47 | - /** |
|
48 | - * @var Mailcode_Commands_LogicKeywords_Keyword[] |
|
49 | - */ |
|
47 | + /** |
|
48 | + * @var Mailcode_Commands_LogicKeywords_Keyword[] |
|
49 | + */ |
|
50 | 50 | private $keywords = array(); |
51 | 51 | |
52 | - /** |
|
53 | - * @var string |
|
54 | - */ |
|
52 | + /** |
|
53 | + * @var string |
|
54 | + */ |
|
55 | 55 | private $mainParams = ''; |
56 | 56 | |
57 | 57 | public function __construct(Mailcode_Commands_Command $command, string $paramsString) |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | - /** |
|
141 | - * @return string[] |
|
142 | - */ |
|
140 | + /** |
|
141 | + * @return string[] |
|
142 | + */ |
|
143 | 143 | private function detectParameters() : array |
144 | 144 | { |
145 | 145 | $params = $this->paramsString; |
@@ -157,13 +157,13 @@ discard block |
||
157 | 157 | return $stack; |
158 | 158 | } |
159 | 159 | |
160 | - /** |
|
161 | - * @param string $params |
|
162 | - * @param Mailcode_Commands_LogicKeywords_Keyword $keyword |
|
163 | - * @param string[] $stack |
|
164 | - * @throws Mailcode_Exception |
|
165 | - * @return string |
|
166 | - */ |
|
160 | + /** |
|
161 | + * @param string $params |
|
162 | + * @param Mailcode_Commands_LogicKeywords_Keyword $keyword |
|
163 | + * @param string[] $stack |
|
164 | + * @throws Mailcode_Exception |
|
165 | + * @return string |
|
166 | + */ |
|
167 | 167 | private function detectParamsKeyword(string $params, Mailcode_Commands_LogicKeywords_Keyword $keyword, array &$stack) : string |
168 | 168 | { |
169 | 169 | $search = $keyword->getMatchedString(); |
@@ -188,22 +188,22 @@ discard block |
||
188 | 188 | return $params; |
189 | 189 | } |
190 | 190 | |
191 | - /** |
|
192 | - * Extracts the parameters string to use for the |
|
193 | - * original command itself, omitting all the logic |
|
194 | - * keywords for the sub-commands. |
|
195 | - * |
|
196 | - * @return string |
|
197 | - */ |
|
191 | + /** |
|
192 | + * Extracts the parameters string to use for the |
|
193 | + * original command itself, omitting all the logic |
|
194 | + * keywords for the sub-commands. |
|
195 | + * |
|
196 | + * @return string |
|
197 | + */ |
|
198 | 198 | public function getMainParamsString() : string |
199 | 199 | { |
200 | 200 | return $this->mainParams; |
201 | 201 | } |
202 | 202 | |
203 | - /** |
|
204 | - * Retrieves the detected keyword names. |
|
205 | - * @return string[] |
|
206 | - */ |
|
203 | + /** |
|
204 | + * Retrieves the detected keyword names. |
|
205 | + * @return string[] |
|
206 | + */ |
|
207 | 207 | public function getDetectedNames() : array |
208 | 208 | { |
209 | 209 | $names = array(); |
@@ -221,23 +221,23 @@ discard block |
||
221 | 221 | return $names; |
222 | 222 | } |
223 | 223 | |
224 | - /** |
|
225 | - * Retrieves all keywords that were detected in the |
|
226 | - * command's parameters string, if any. |
|
227 | - * |
|
228 | - * @return Mailcode_Commands_LogicKeywords_Keyword[] |
|
229 | - */ |
|
224 | + /** |
|
225 | + * Retrieves all keywords that were detected in the |
|
226 | + * command's parameters string, if any. |
|
227 | + * |
|
228 | + * @return Mailcode_Commands_LogicKeywords_Keyword[] |
|
229 | + */ |
|
230 | 230 | public function getKeywords() : array |
231 | 231 | { |
232 | 232 | return $this->keywords; |
233 | 233 | } |
234 | 234 | |
235 | - /** |
|
236 | - * Detects any keyword statements in the parameters by keyword name. |
|
237 | - * |
|
238 | - * @param string $name |
|
239 | - * @return Mailcode_Commands_LogicKeywords_Keyword[] |
|
240 | - */ |
|
235 | + /** |
|
236 | + * Detects any keyword statements in the parameters by keyword name. |
|
237 | + * |
|
238 | + * @param string $name |
|
239 | + * @return Mailcode_Commands_LogicKeywords_Keyword[] |
|
240 | + */ |
|
241 | 241 | private function detectKeywords(string $name) : array |
242 | 242 | { |
243 | 243 | $regex = sprintf('/%1$s\s+([a-z\-0-9]+):|%1$s:/x', $name); |
@@ -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(); |
@@ -43,44 +43,44 @@ discard block |
||
43 | 43 | |
44 | 44 | public const META_URL_ENCODING = 'url_encoding'; |
45 | 45 | |
46 | - /** |
|
47 | - * @var string |
|
48 | - */ |
|
46 | + /** |
|
47 | + * @var string |
|
48 | + */ |
|
49 | 49 | protected $type = ''; |
50 | 50 | |
51 | - /** |
|
52 | - * @var string |
|
53 | - */ |
|
51 | + /** |
|
52 | + * @var string |
|
53 | + */ |
|
54 | 54 | protected $paramsString = ''; |
55 | 55 | |
56 | - /** |
|
57 | - * @var string |
|
58 | - */ |
|
56 | + /** |
|
57 | + * @var string |
|
58 | + */ |
|
59 | 59 | protected $matchedText = ''; |
60 | 60 | |
61 | - /** |
|
62 | - * @var string |
|
63 | - */ |
|
61 | + /** |
|
62 | + * @var string |
|
63 | + */ |
|
64 | 64 | protected $hash = ''; |
65 | 65 | |
66 | - /** |
|
67 | - * @var OperationResult |
|
68 | - */ |
|
66 | + /** |
|
67 | + * @var OperationResult |
|
68 | + */ |
|
69 | 69 | protected $validationResult = null; |
70 | 70 | |
71 | - /** |
|
72 | - * @var Mailcode |
|
73 | - */ |
|
71 | + /** |
|
72 | + * @var Mailcode |
|
73 | + */ |
|
74 | 74 | protected $mailcode; |
75 | 75 | |
76 | - /** |
|
77 | - * @var Mailcode_Parser_Statement |
|
78 | - */ |
|
76 | + /** |
|
77 | + * @var Mailcode_Parser_Statement |
|
78 | + */ |
|
79 | 79 | protected $params; |
80 | 80 | |
81 | - /** |
|
82 | - * @var string[] |
|
83 | - */ |
|
81 | + /** |
|
82 | + * @var string[] |
|
83 | + */ |
|
84 | 84 | protected $validations = array( |
85 | 85 | Mailcode_Interfaces_Commands_Validation_EmptyParams::VALIDATION_NAME_EMPTY_PARAMS, |
86 | 86 | Mailcode_Interfaces_Commands_Validation_ParamKeywords::VALIDATION_NAME_KEYWORDS, |
@@ -89,24 +89,24 @@ discard block |
||
89 | 89 | Mailcode_Interfaces_Commands_Validation_TypeUnsupported::VALIDATION_NAME_TYPE_UNSUPPORTED |
90 | 90 | ); |
91 | 91 | |
92 | - /** |
|
93 | - * @var string |
|
94 | - */ |
|
92 | + /** |
|
93 | + * @var string |
|
94 | + */ |
|
95 | 95 | protected $comment = ''; |
96 | 96 | |
97 | - /** |
|
98 | - * @var Mailcode_Commands_LogicKeywords|NULL |
|
99 | - */ |
|
97 | + /** |
|
98 | + * @var Mailcode_Commands_LogicKeywords|NULL |
|
99 | + */ |
|
100 | 100 | protected $logicKeywords; |
101 | 101 | |
102 | - /** |
|
103 | - * @var Mailcode_Parser_Statement_Validator |
|
104 | - */ |
|
102 | + /** |
|
103 | + * @var Mailcode_Parser_Statement_Validator |
|
104 | + */ |
|
105 | 105 | protected $validator; |
106 | 106 | |
107 | - /** |
|
108 | - * @var boolean |
|
109 | - */ |
|
107 | + /** |
|
108 | + * @var boolean |
|
109 | + */ |
|
110 | 110 | private $validated = false; |
111 | 111 | |
112 | 112 | /** |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | |
142 | 142 | } |
143 | 143 | |
144 | - /** |
|
145 | - * Sets the command's parent opening command, if any. |
|
146 | - * NOTE: This is set automatically by the parser, and |
|
147 | - * should not be called manually. |
|
148 | - * |
|
149 | - * @param Mailcode_Commands_Command $command |
|
150 | - */ |
|
144 | + /** |
|
145 | + * Sets the command's parent opening command, if any. |
|
146 | + * NOTE: This is set automatically by the parser, and |
|
147 | + * should not be called manually. |
|
148 | + * |
|
149 | + * @param Mailcode_Commands_Command $command |
|
150 | + */ |
|
151 | 151 | public function setParent(Mailcode_Commands_Command $command) : void |
152 | 152 | { |
153 | 153 | $this->parent = $command; |
@@ -289,9 +289,9 @@ discard block |
||
289 | 289 | return $this->validationResult->isValid(); |
290 | 290 | } |
291 | 291 | |
292 | - /** |
|
293 | - * @return string[] |
|
294 | - */ |
|
292 | + /** |
|
293 | + * @return string[] |
|
294 | + */ |
|
295 | 295 | abstract protected function getValidations() : array; |
296 | 296 | |
297 | 297 | protected function _validateNesting() : void |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | public const VALIDATION_INVALID_DECIMAL_SEPARATOR = 72209; |
32 | 32 | public const VALIDATION_SEPARATORS_SAME_CHARACTER = 72210; |
33 | 33 | |
34 | - /** |
|
35 | - * The default number format string. |
|
36 | - * @var string |
|
37 | - */ |
|
34 | + /** |
|
35 | + * The default number format string. |
|
36 | + * @var string |
|
37 | + */ |
|
38 | 38 | private $formatString = Mailcode_Number_Info::DEFAULT_FORMAT; |
39 | 39 | |
40 | 40 | /** |
@@ -65,16 +65,16 @@ discard block |
||
65 | 65 | |
66 | 66 | protected function validateSyntax_check_format() : void |
67 | 67 | { |
68 | - $tokens = $this->params->getInfo()->getStringLiterals(); |
|
68 | + $tokens = $this->params->getInfo()->getStringLiterals(); |
|
69 | 69 | |
70 | - // no format specified? Use the default one. |
|
71 | - if(empty($tokens)) |
|
72 | - { |
|
73 | - return; |
|
74 | - } |
|
75 | - |
|
76 | - $token = array_pop($tokens); |
|
77 | - $this->parseFormatString($token->getText()); |
|
70 | + // no format specified? Use the default one. |
|
71 | + if(empty($tokens)) |
|
72 | + { |
|
73 | + return; |
|
74 | + } |
|
75 | + |
|
76 | + $token = array_pop($tokens); |
|
77 | + $this->parseFormatString($token->getText()); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | protected function validateSyntax_absolute() : void |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | ); |
108 | 108 | } |
109 | 109 | |
110 | - /** |
|
111 | - * Retrieves the format string used to format the number. |
|
112 | - * |
|
113 | - * @return string |
|
114 | - */ |
|
110 | + /** |
|
111 | + * Retrieves the format string used to format the number. |
|
112 | + * |
|
113 | + * @return string |
|
114 | + */ |
|
115 | 115 | public function getFormatString() : string |
116 | 116 | { |
117 | 117 | return $this->formatString; |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | |
133 | 133 | if($absolute === true && !isset($this->absoluteKeyword)) |
134 | 134 | { |
135 | - $this->params |
|
136 | - ->getInfo() |
|
137 | - ->addKeyword(Mailcode_Commands_Keywords::TYPE_ABSOLUTE); |
|
135 | + $this->params |
|
136 | + ->getInfo() |
|
137 | + ->addKeyword(Mailcode_Commands_Keywords::TYPE_ABSOLUTE); |
|
138 | 138 | |
139 | - $this->validateSyntax_absolute(); |
|
139 | + $this->validateSyntax_absolute(); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | return $this; |