@@ -20,19 +20,19 @@ discard block |
||
20 | 20 | */ |
21 | 21 | abstract class Mailcode_Parser_Statement_Tokenizer_Token implements Mailcode_Parser_Statement_Tokenizer_TypeInterface |
22 | 22 | { |
23 | - /** |
|
24 | - * @var string |
|
25 | - */ |
|
23 | + /** |
|
24 | + * @var string |
|
25 | + */ |
|
26 | 26 | protected $tokenID; |
27 | 27 | |
28 | - /** |
|
29 | - * @var string |
|
30 | - */ |
|
28 | + /** |
|
29 | + * @var string |
|
30 | + */ |
|
31 | 31 | protected $matchedText; |
32 | 32 | |
33 | - /** |
|
34 | - * @var mixed |
|
35 | - */ |
|
33 | + /** |
|
34 | + * @var mixed |
|
35 | + */ |
|
36 | 36 | protected $subject; |
37 | 37 | |
38 | 38 | /** |
@@ -62,20 +62,20 @@ discard block |
||
62 | 62 | return $this->sourceCommand; |
63 | 63 | } |
64 | 64 | |
65 | - /** |
|
66 | - * The ID of the type. i.e. the class name ("Keyword", "StringLiteral"). |
|
67 | - * @return string |
|
68 | - */ |
|
65 | + /** |
|
66 | + * The ID of the type. i.e. the class name ("Keyword", "StringLiteral"). |
|
67 | + * @return string |
|
68 | + */ |
|
69 | 69 | public function getTypeID() : string |
70 | 70 | { |
71 | 71 | $parts = explode('_', get_class($this)); |
72 | 72 | return array_pop($parts); |
73 | 73 | } |
74 | 74 | |
75 | - /** |
|
76 | - * Retrieves a unique ID of the token. |
|
77 | - * @return string |
|
78 | - */ |
|
75 | + /** |
|
76 | + * Retrieves a unique ID of the token. |
|
77 | + * @return string |
|
78 | + */ |
|
79 | 79 | public function getID() : string |
80 | 80 | { |
81 | 81 | return $this->tokenID; |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | 'ExtractTokens' |
39 | 39 | ); |
40 | 40 | |
41 | - /** |
|
42 | - * @var Mailcode_Parser_Statement |
|
43 | - */ |
|
41 | + /** |
|
42 | + * @var Mailcode_Parser_Statement |
|
43 | + */ |
|
44 | 44 | protected $statement; |
45 | 45 | |
46 | - /** |
|
47 | - * @var string |
|
48 | - */ |
|
46 | + /** |
|
47 | + * @var string |
|
48 | + */ |
|
49 | 49 | protected $tokenized; |
50 | 50 | |
51 | 51 | /** |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | */ |
54 | 54 | protected $tokensOrdered = array(); |
55 | 55 | |
56 | - /** |
|
57 | - * @var string[] |
|
58 | - */ |
|
56 | + /** |
|
57 | + * @var string[] |
|
58 | + */ |
|
59 | 59 | protected static $ids = array(); |
60 | 60 | |
61 | 61 | /** |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | return $this->statement->getSourceCommand(); |
76 | 76 | } |
77 | 77 | |
78 | - /** |
|
79 | - * Retrieves all tokens detected in the statement string, in |
|
80 | - * the order they were found. |
|
81 | - * |
|
82 | - * @return Mailcode_Parser_Statement_Tokenizer_Token[] |
|
83 | - */ |
|
78 | + /** |
|
79 | + * Retrieves all tokens detected in the statement string, in |
|
80 | + * the order they were found. |
|
81 | + * |
|
82 | + * @return Mailcode_Parser_Statement_Tokenizer_Token[] |
|
83 | + */ |
|
84 | 84 | public function getTokens() |
85 | 85 | { |
86 | 86 | return $this->tokensOrdered; |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | return !empty($this->tokensOrdered); |
92 | 92 | } |
93 | 93 | |
94 | - /** |
|
95 | - * Whether there were any unknown tokens in the statement. |
|
96 | - * |
|
97 | - * @return bool |
|
98 | - */ |
|
94 | + /** |
|
95 | + * Whether there were any unknown tokens in the statement. |
|
96 | + * |
|
97 | + * @return bool |
|
98 | + */ |
|
99 | 99 | public function hasUnknown() : bool |
100 | 100 | { |
101 | 101 | $unknown = $this->getUnknown(); |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | return !empty($unknown); |
104 | 104 | } |
105 | 105 | |
106 | - /** |
|
107 | - * Retrieves all unknown content tokens, if any. |
|
108 | - * |
|
109 | - * @return Mailcode_Parser_Statement_Tokenizer_Token_Unknown[] |
|
110 | - */ |
|
106 | + /** |
|
107 | + * Retrieves all unknown content tokens, if any. |
|
108 | + * |
|
109 | + * @return Mailcode_Parser_Statement_Tokenizer_Token_Unknown[] |
|
110 | + */ |
|
111 | 111 | public function getUnknown() |
112 | 112 | { |
113 | 113 | $result = array(); |
@@ -278,13 +278,13 @@ discard block |
||
278 | 278 | return $token; |
279 | 279 | } |
280 | 280 | |
281 | - /** |
|
282 | - * Generates a unique alphabet-based ID without numbers |
|
283 | - * to use as token name, to avoid conflicts with the |
|
284 | - * numbers detection. |
|
285 | - * |
|
286 | - * @return string |
|
287 | - */ |
|
281 | + /** |
|
282 | + * Generates a unique alphabet-based ID without numbers |
|
283 | + * to use as token name, to avoid conflicts with the |
|
284 | + * numbers detection. |
|
285 | + * |
|
286 | + * @return string |
|
287 | + */ |
|
288 | 288 | protected function generateID() : string |
289 | 289 | { |
290 | 290 | static $alphas; |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | '{\s*([a-z]+)\s+([a-z-]+)\s*:([^}]*)}' |
31 | 31 | ); |
32 | 32 | |
33 | - /** |
|
34 | - * @var Mailcode |
|
35 | - */ |
|
33 | + /** |
|
34 | + * @var Mailcode |
|
35 | + */ |
|
36 | 36 | protected $mailcode; |
37 | 37 | |
38 | - /** |
|
39 | - * @var Mailcode_Commands |
|
40 | - */ |
|
38 | + /** |
|
39 | + * @var Mailcode_Commands |
|
40 | + */ |
|
41 | 41 | protected $commands; |
42 | 42 | |
43 | 43 | /** |
@@ -51,24 +51,24 @@ discard block |
||
51 | 51 | $this->commands = $this->mailcode->getCommands(); |
52 | 52 | } |
53 | 53 | |
54 | - /** |
|
55 | - * Gets the regex format string used to detect commands. |
|
56 | - * |
|
57 | - * @return string |
|
58 | - */ |
|
54 | + /** |
|
55 | + * Gets the regex format string used to detect commands. |
|
56 | + * |
|
57 | + * @return string |
|
58 | + */ |
|
59 | 59 | protected static function getRegex() : string |
60 | 60 | { |
61 | 61 | return '/'.implode('|', self::COMMAND_REGEX_PARTS).'/sixU'; |
62 | 62 | } |
63 | 63 | |
64 | - /** |
|
65 | - * Parses a string to detect all commands within. Returns a |
|
66 | - * collection instance that contains information on all the |
|
67 | - * commands. |
|
68 | - * |
|
69 | - * @param string $string |
|
70 | - * @return Mailcode_Collection A collection with all unique commands found. |
|
71 | - */ |
|
64 | + /** |
|
65 | + * Parses a string to detect all commands within. Returns a |
|
66 | + * collection instance that contains information on all the |
|
67 | + * commands. |
|
68 | + * |
|
69 | + * @param string $string |
|
70 | + * @return Mailcode_Collection A collection with all unique commands found. |
|
71 | + */ |
|
72 | 72 | public function parseString(string $string) : Mailcode_Collection |
73 | 73 | { |
74 | 74 | $collection = new Mailcode_Collection(); |
@@ -103,14 +103,14 @@ discard block |
||
103 | 103 | return preg_replace('%<style\b[^>]*>(.*?)</style>%six', '', $subject); |
104 | 104 | } |
105 | 105 | |
106 | - /** |
|
107 | - * Processes a single match found in the string: creates the command, |
|
108 | - * and adds it to the collection if it's a valid command, or to the list |
|
109 | - * of invalid commands otherwise. |
|
110 | - * |
|
111 | - * @param Mailcode_Parser_Match $match |
|
112 | - * @param Mailcode_Collection $collection |
|
113 | - */ |
|
106 | + /** |
|
107 | + * Processes a single match found in the string: creates the command, |
|
108 | + * and adds it to the collection if it's a valid command, or to the list |
|
109 | + * of invalid commands otherwise. |
|
110 | + * |
|
111 | + * @param Mailcode_Parser_Match $match |
|
112 | + * @param Mailcode_Collection $collection |
|
113 | + */ |
|
114 | 114 | protected function processMatch(Mailcode_Parser_Match $match, Mailcode_Collection $collection) : void |
115 | 115 | { |
116 | 116 | $name = $match->getName(); |
@@ -173,14 +173,14 @@ discard block |
||
173 | 173 | throw new Mailcode_Exception('Not a command', '', self::ERROR_NOT_A_COMMAND); |
174 | 174 | } |
175 | 175 | |
176 | - /** |
|
177 | - * Parses a single regex match: determines which named group |
|
178 | - * matches, and retrieves the according information. |
|
179 | - * |
|
180 | - * @param array[] $matches The regex results array. |
|
181 | - * @param int $index The matched index. |
|
182 | - * @return Mailcode_Parser_Match |
|
183 | - */ |
|
176 | + /** |
|
177 | + * Parses a single regex match: determines which named group |
|
178 | + * matches, and retrieves the according information. |
|
179 | + * |
|
180 | + * @param array[] $matches The regex results array. |
|
181 | + * @param int $index The matched index. |
|
182 | + * @return Mailcode_Parser_Match |
|
183 | + */ |
|
184 | 184 | protected function parseMatch(array $matches, int $index) : Mailcode_Parser_Match |
185 | 185 | { |
186 | 186 | $name = ''; // the command name, e.g. "showvar" |
@@ -218,14 +218,14 @@ discard block |
||
218 | 218 | ); |
219 | 219 | } |
220 | 220 | |
221 | - /** |
|
222 | - * Creates an instance of the safeguard tool, which |
|
223 | - * is used to safeguard commands in a string with placeholders. |
|
224 | - * |
|
225 | - * @param string $subject The string to use to safeguard commands in. |
|
226 | - * @return Mailcode_Parser_Safeguard |
|
227 | - * @see Mailcode_Parser_Safeguard |
|
228 | - */ |
|
221 | + /** |
|
222 | + * Creates an instance of the safeguard tool, which |
|
223 | + * is used to safeguard commands in a string with placeholders. |
|
224 | + * |
|
225 | + * @param string $subject The string to use to safeguard commands in. |
|
226 | + * @return Mailcode_Parser_Safeguard |
|
227 | + * @see Mailcode_Parser_Safeguard |
|
228 | + */ |
|
229 | 229 | public function createSafeguard(string $subject) : Mailcode_Parser_Safeguard |
230 | 230 | { |
231 | 231 | return new Mailcode_Parser_Safeguard($this, $subject); |