@@ -25,11 +25,11 @@ |
||
25 | 25 | return PHP_INT_MAX; |
26 | 26 | } |
27 | 27 | |
28 | - /** |
|
29 | - * Formats the specified string according to the formatter. |
|
30 | - * Retrieve the updated string from the string container used |
|
31 | - * to create the formatter, or use `getSubjectString()`. |
|
32 | - */ |
|
28 | + /** |
|
29 | + * Formats the specified string according to the formatter. |
|
30 | + * Retrieve the updated string from the string container used |
|
31 | + * to create the formatter, or use `getSubjectString()`. |
|
32 | + */ |
|
33 | 33 | public function format() : void |
34 | 34 | { |
35 | 35 | $locations = $this->resolveLocations(); |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | */ |
22 | 22 | class Mailcode_Parser_Statement_Info |
23 | 23 | { |
24 | - /** |
|
25 | - * @var Mailcode_Parser_Statement_Tokenizer |
|
26 | - */ |
|
24 | + /** |
|
25 | + * @var Mailcode_Parser_Statement_Tokenizer |
|
26 | + */ |
|
27 | 27 | protected $tokenizer; |
28 | 28 | |
29 | - /** |
|
30 | - * @var Mailcode_Parser_Statement_Tokenizer_Token[] |
|
31 | - */ |
|
29 | + /** |
|
30 | + * @var Mailcode_Parser_Statement_Tokenizer_Token[] |
|
31 | + */ |
|
32 | 32 | protected $tokens = array(); |
33 | 33 | |
34 | 34 | /** |
@@ -52,21 +52,21 @@ discard block |
||
52 | 52 | $this->tokenizer->onTokensChanged(array($this, 'handleTokensChanged')); |
53 | 53 | } |
54 | 54 | |
55 | - /** |
|
56 | - * Whether the whole statement is a variable being assigned a value. |
|
57 | - * |
|
58 | - * @return bool |
|
59 | - */ |
|
55 | + /** |
|
56 | + * Whether the whole statement is a variable being assigned a value. |
|
57 | + * |
|
58 | + * @return bool |
|
59 | + */ |
|
60 | 60 | public function isVariableAssignment() : bool |
61 | 61 | { |
62 | 62 | return $this->variables->isAssignment(); |
63 | 63 | } |
64 | 64 | |
65 | - /** |
|
66 | - * Whether the whole statement is a variable being compared to something. |
|
67 | - * |
|
68 | - * @return bool |
|
69 | - */ |
|
65 | + /** |
|
66 | + * Whether the whole statement is a variable being compared to something. |
|
67 | + * |
|
68 | + * @return bool |
|
69 | + */ |
|
70 | 70 | public function isVariableComparison() : bool |
71 | 71 | { |
72 | 72 | return $this->variables->isComparison(); |
@@ -83,27 +83,27 @@ discard block |
||
83 | 83 | return $this->variables->getAll(); |
84 | 84 | } |
85 | 85 | |
86 | - /** |
|
87 | - * Retrieves a variable by its position in the command's parameters. |
|
88 | - * Returns null if there is no parameter at the specified index, or |
|
89 | - * if it is of another type. |
|
90 | - * |
|
91 | - * @param int $index Zero-based index. |
|
92 | - * @return Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
93 | - */ |
|
86 | + /** |
|
87 | + * Retrieves a variable by its position in the command's parameters. |
|
88 | + * Returns null if there is no parameter at the specified index, or |
|
89 | + * if it is of another type. |
|
90 | + * |
|
91 | + * @param int $index Zero-based index. |
|
92 | + * @return Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
93 | + */ |
|
94 | 94 | public function getVariableByIndex(int $index) : ?Mailcode_Parser_Statement_Tokenizer_Token_Variable |
95 | 95 | { |
96 | 96 | return $this->variables->getByIndex($index); |
97 | 97 | } |
98 | 98 | |
99 | - /** |
|
100 | - * Retrieves a string literal by its position in the command's parameters. |
|
101 | - * Returns null if there is no parameter at the specified index, or |
|
102 | - * if it is of another type. |
|
103 | - * |
|
104 | - * @param int $index Zero-based index. |
|
105 | - * @return Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral|NULL |
|
106 | - */ |
|
99 | + /** |
|
100 | + * Retrieves a string literal by its position in the command's parameters. |
|
101 | + * Returns null if there is no parameter at the specified index, or |
|
102 | + * if it is of another type. |
|
103 | + * |
|
104 | + * @param int $index Zero-based index. |
|
105 | + * @return Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral|NULL |
|
106 | + */ |
|
107 | 107 | public function getStringLiteralByIndex(int $index) : ?Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral |
108 | 108 | { |
109 | 109 | $token = $this->getTokenByIndex($index); |
@@ -116,27 +116,27 @@ discard block |
||
116 | 116 | return null; |
117 | 117 | } |
118 | 118 | |
119 | - /** |
|
120 | - * Retrieves a keyword by its position in the command's parameters. |
|
121 | - * Returns null if there is no parameter at the specified index, or |
|
122 | - * if it is of another type. |
|
123 | - * |
|
124 | - * @param int $index Zero-based index. |
|
125 | - * @return Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL |
|
126 | - */ |
|
119 | + /** |
|
120 | + * Retrieves a keyword by its position in the command's parameters. |
|
121 | + * Returns null if there is no parameter at the specified index, or |
|
122 | + * if it is of another type. |
|
123 | + * |
|
124 | + * @param int $index Zero-based index. |
|
125 | + * @return Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL |
|
126 | + */ |
|
127 | 127 | public function getKeywordByIndex(int $index) : ?Mailcode_Parser_Statement_Tokenizer_Token_Keyword |
128 | 128 | { |
129 | 129 | return $this->keywords->getByIndex($index); |
130 | 130 | } |
131 | 131 | |
132 | - /** |
|
133 | - * Retrieves an operand by its position in the command's parameters. |
|
134 | - * Returns null if there is no parameter at the specified index, or |
|
135 | - * if it is of another type. |
|
136 | - * |
|
137 | - * @param int $index Zero-based index. |
|
138 | - * @return Mailcode_Parser_Statement_Tokenizer_Token_Operand|NULL |
|
139 | - */ |
|
132 | + /** |
|
133 | + * Retrieves an operand by its position in the command's parameters. |
|
134 | + * Returns null if there is no parameter at the specified index, or |
|
135 | + * if it is of another type. |
|
136 | + * |
|
137 | + * @param int $index Zero-based index. |
|
138 | + * @return Mailcode_Parser_Statement_Tokenizer_Token_Operand|NULL |
|
139 | + */ |
|
140 | 140 | public function getOperandByIndex(int $index) : ?Mailcode_Parser_Statement_Tokenizer_Token_Operand |
141 | 141 | { |
142 | 142 | $token = $this->getTokenByIndex($index); |
@@ -149,14 +149,14 @@ discard block |
||
149 | 149 | return null; |
150 | 150 | } |
151 | 151 | |
152 | - /** |
|
153 | - * Retrieves a parameter token by its position in the command's parameters, |
|
154 | - * regardless of its type. Returns null if there is no parameter at the |
|
155 | - * specified index. |
|
156 | - * |
|
157 | - * @param int $index Zero-based index. |
|
158 | - * @return Mailcode_Parser_Statement_Tokenizer_Token|NULL |
|
159 | - */ |
|
152 | + /** |
|
153 | + * Retrieves a parameter token by its position in the command's parameters, |
|
154 | + * regardless of its type. Returns null if there is no parameter at the |
|
155 | + * specified index. |
|
156 | + * |
|
157 | + * @param int $index Zero-based index. |
|
158 | + * @return Mailcode_Parser_Statement_Tokenizer_Token|NULL |
|
159 | + */ |
|
160 | 160 | public function getTokenByIndex(int $index) : ?Mailcode_Parser_Statement_Tokenizer_Token |
161 | 161 | { |
162 | 162 | if(isset($this->tokens[$index])) |
@@ -172,19 +172,19 @@ discard block |
||
172 | 172 | return isset($this->tokens[$index]); |
173 | 173 | } |
174 | 174 | |
175 | - /** |
|
176 | - * Retrieves all tokens. |
|
177 | - * @return Mailcode_Parser_Statement_Tokenizer_Token[] |
|
178 | - */ |
|
175 | + /** |
|
176 | + * Retrieves all tokens. |
|
177 | + * @return Mailcode_Parser_Statement_Tokenizer_Token[] |
|
178 | + */ |
|
179 | 179 | public function getTokens() : array |
180 | 180 | { |
181 | 181 | return $this->tokens; |
182 | 182 | } |
183 | 183 | |
184 | - /** |
|
185 | - * Retrieves all string literals that were found in the command. |
|
186 | - * @return Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral[] |
|
187 | - */ |
|
184 | + /** |
|
185 | + * Retrieves all string literals that were found in the command. |
|
186 | + * @return Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral[] |
|
187 | + */ |
|
188 | 188 | public function getStringLiterals() : array |
189 | 189 | { |
190 | 190 | $result = array(); |
@@ -21,17 +21,17 @@ discard block |
||
21 | 21 | */ |
22 | 22 | class Mailcode_Renderer |
23 | 23 | { |
24 | - /** |
|
25 | - * @var boolean |
|
26 | - */ |
|
24 | + /** |
|
25 | + * @var boolean |
|
26 | + */ |
|
27 | 27 | protected $highlighted = false; |
28 | 28 | |
29 | - /** |
|
30 | - * Sets whether to output highlighted commands instead of the default plain text. |
|
31 | - * |
|
32 | - * @param bool $highlighted |
|
33 | - * @return Mailcode_Renderer |
|
34 | - */ |
|
29 | + /** |
|
30 | + * Sets whether to output highlighted commands instead of the default plain text. |
|
31 | + * |
|
32 | + * @param bool $highlighted |
|
33 | + * @return Mailcode_Renderer |
|
34 | + */ |
|
35 | 35 | public function setOutputHighlighted(bool $highlighted=true) : Mailcode_Renderer |
36 | 36 | { |
37 | 37 | $this->highlighted = $highlighted; |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | return $this; |
40 | 40 | } |
41 | 41 | |
42 | - /** |
|
43 | - * Converts a show variable command to string. |
|
44 | - * |
|
45 | - * @param string $variableName The variable name, with or without $ sign. |
|
46 | - * @return string |
|
47 | - */ |
|
42 | + /** |
|
43 | + * Converts a show variable command to string. |
|
44 | + * |
|
45 | + * @param string $variableName The variable name, with or without $ sign. |
|
46 | + * @return string |
|
47 | + */ |
|
48 | 48 | public function showVar(string $variableName) : string |
49 | 49 | { |
50 | 50 | return $this->command2string(Mailcode_Factory::show()->var($variableName)); |
@@ -176,27 +176,27 @@ |
||
176 | 176 | * @return array<string,string> |
177 | 177 | * @throws Mailcode_Exception |
178 | 178 | */ |
179 | - private function parseVarName() : array |
|
180 | - { |
|
181 | - $tokens = explode('.', ltrim($this->variable->getFullName(), '$')); |
|
182 | - |
|
183 | - if(count($tokens) === 2) |
|
184 | - { |
|
185 | - return array( |
|
186 | - 'path' => $tokens[0], |
|
187 | - 'name' => $tokens[1] |
|
188 | - ); |
|
189 | - } |
|
190 | - |
|
191 | - throw new Mailcode_Exception( |
|
192 | - 'Invalid variable name for a list property.', |
|
193 | - sprintf( |
|
194 | - 'Exactly 2 parts are required, variable [%s] has [%s].', |
|
195 | - $this->variable->getFullName(), |
|
196 | - count($tokens) |
|
197 | - ), |
|
198 | - self::ERROR_INVALID_LIST_VARIABLE_NAME |
|
199 | - ); |
|
200 | - } |
|
179 | + private function parseVarName() : array |
|
180 | + { |
|
181 | + $tokens = explode('.', ltrim($this->variable->getFullName(), '$')); |
|
182 | + |
|
183 | + if(count($tokens) === 2) |
|
184 | + { |
|
185 | + return array( |
|
186 | + 'path' => $tokens[0], |
|
187 | + 'name' => $tokens[1] |
|
188 | + ); |
|
189 | + } |
|
190 | + |
|
191 | + throw new Mailcode_Exception( |
|
192 | + 'Invalid variable name for a list property.', |
|
193 | + sprintf( |
|
194 | + 'Exactly 2 parts are required, variable [%s] has [%s].', |
|
195 | + $this->variable->getFullName(), |
|
196 | + count($tokens) |
|
197 | + ), |
|
198 | + self::ERROR_INVALID_LIST_VARIABLE_NAME |
|
199 | + ); |
|
200 | + } |
|
201 | 201 | } |
202 | 202 |
@@ -26,51 +26,51 @@ discard block |
||
26 | 26 | */ |
27 | 27 | class Mailcode |
28 | 28 | { |
29 | - /** |
|
30 | - * @var Mailcode_Parser|NULL |
|
31 | - */ |
|
29 | + /** |
|
30 | + * @var Mailcode_Parser|NULL |
|
31 | + */ |
|
32 | 32 | protected $parser = null; |
33 | 33 | |
34 | - /** |
|
35 | - * @var Mailcode_Commands|NULL |
|
36 | - */ |
|
34 | + /** |
|
35 | + * @var Mailcode_Commands|NULL |
|
36 | + */ |
|
37 | 37 | protected $commands = null; |
38 | 38 | |
39 | - /** |
|
40 | - * @var Mailcode_Variables|NULL |
|
41 | - */ |
|
39 | + /** |
|
40 | + * @var Mailcode_Variables|NULL |
|
41 | + */ |
|
42 | 42 | protected $variables = null; |
43 | 43 | |
44 | - /** |
|
45 | - * @var Mailcode_Translator|NULL |
|
46 | - */ |
|
44 | + /** |
|
45 | + * @var Mailcode_Translator|NULL |
|
46 | + */ |
|
47 | 47 | protected $translator = null; |
48 | 48 | |
49 | - /** |
|
50 | - * Creates a new mailcode instance. |
|
51 | - * @return Mailcode |
|
52 | - */ |
|
49 | + /** |
|
50 | + * Creates a new mailcode instance. |
|
51 | + * @return Mailcode |
|
52 | + */ |
|
53 | 53 | public static function create() : Mailcode |
54 | 54 | { |
55 | 55 | return new Mailcode(); |
56 | 56 | } |
57 | 57 | |
58 | - /** |
|
59 | - * Parses the string to detect all commands contained within. |
|
60 | - * |
|
61 | - * @param string $string |
|
62 | - * @return Mailcode_Collection |
|
63 | - */ |
|
58 | + /** |
|
59 | + * Parses the string to detect all commands contained within. |
|
60 | + * |
|
61 | + * @param string $string |
|
62 | + * @return Mailcode_Collection |
|
63 | + */ |
|
64 | 64 | public function parseString(string $string) : Mailcode_Collection |
65 | 65 | { |
66 | 66 | return $this->getParser()->parseString($string); |
67 | 67 | } |
68 | 68 | |
69 | - /** |
|
70 | - * Retrieves the string parser instance used to detect commands. |
|
71 | - * |
|
72 | - * @return Mailcode_Parser |
|
73 | - */ |
|
69 | + /** |
|
70 | + * Retrieves the string parser instance used to detect commands. |
|
71 | + * |
|
72 | + * @return Mailcode_Parser |
|
73 | + */ |
|
74 | 74 | public function getParser() : Mailcode_Parser |
75 | 75 | { |
76 | 76 | if(!isset($this->parser)) |
@@ -81,12 +81,12 @@ discard block |
||
81 | 81 | return $this->parser; |
82 | 82 | } |
83 | 83 | |
84 | - /** |
|
85 | - * Retrieves the commands collection, which is used to |
|
86 | - * access information on the available commands. |
|
87 | - * |
|
88 | - * @return Mailcode_Commands |
|
89 | - */ |
|
84 | + /** |
|
85 | + * Retrieves the commands collection, which is used to |
|
86 | + * access information on the available commands. |
|
87 | + * |
|
88 | + * @return Mailcode_Commands |
|
89 | + */ |
|
90 | 90 | public function getCommands() : Mailcode_Commands |
91 | 91 | { |
92 | 92 | if(!isset($this->commands)) |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | return $this->variables; |
130 | 130 | } |
131 | 131 | |
132 | - /** |
|
133 | - * Creates the translator, which can be used to convert commands |
|
134 | - * to another supported syntax. |
|
135 | - * |
|
136 | - * @return Mailcode_Translator |
|
137 | - */ |
|
132 | + /** |
|
133 | + * Creates the translator, which can be used to convert commands |
|
134 | + * to another supported syntax. |
|
135 | + * |
|
136 | + * @return Mailcode_Translator |
|
137 | + */ |
|
138 | 138 | public function createTranslator() : Mailcode_Translator |
139 | 139 | { |
140 | 140 | if(!isset($this->translator)) |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | return $this->translator; |
146 | 146 | } |
147 | 147 | |
148 | - /** |
|
149 | - * Creates the styler, which can be used to retrieve the |
|
150 | - * CSS required to style the highlighted commands in HTML. |
|
151 | - * |
|
152 | - * @return Mailcode_Styler |
|
153 | - */ |
|
148 | + /** |
|
149 | + * Creates the styler, which can be used to retrieve the |
|
150 | + * CSS required to style the highlighted commands in HTML. |
|
151 | + * |
|
152 | + * @return Mailcode_Styler |
|
153 | + */ |
|
154 | 154 | public function createStyler() : Mailcode_Styler |
155 | 155 | { |
156 | 156 | return new Mailcode_Styler(); |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | */ |
21 | 21 | abstract class Mailcode_Variables_Collection |
22 | 22 | { |
23 | - /** |
|
24 | - * @var Mailcode_Variables_Variable[] |
|
25 | - */ |
|
23 | + /** |
|
24 | + * @var Mailcode_Variables_Variable[] |
|
25 | + */ |
|
26 | 26 | protected $variables = array(); |
27 | 27 | |
28 | 28 | public function __construct() |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | return count($this->variables); |
53 | 53 | } |
54 | 54 | |
55 | - /** |
|
56 | - * Checks whether the collection contains a variable with the specified name. |
|
57 | - * |
|
58 | - * @param string $fullName The variable name, with or without $ sign. |
|
59 | - * @return bool |
|
60 | - */ |
|
55 | + /** |
|
56 | + * Checks whether the collection contains a variable with the specified name. |
|
57 | + * |
|
58 | + * @param string $fullName The variable name, with or without $ sign. |
|
59 | + * @return bool |
|
60 | + */ |
|
61 | 61 | public function hasVariableName(string $fullName) : bool |
62 | 62 | { |
63 | 63 | $fullName = $this->fixName($fullName); |
@@ -73,14 +73,14 @@ discard block |
||
73 | 73 | return false; |
74 | 74 | } |
75 | 75 | |
76 | - /** |
|
77 | - * Retrieves a collection of all variable instances for |
|
78 | - * the specified name (there can be several with differing |
|
79 | - * matched texts because of spacing). |
|
80 | - * |
|
81 | - * @param string $fullName |
|
82 | - * @return Mailcode_Variables_Collection |
|
83 | - */ |
|
76 | + /** |
|
77 | + * Retrieves a collection of all variable instances for |
|
78 | + * the specified name (there can be several with differing |
|
79 | + * matched texts because of spacing). |
|
80 | + * |
|
81 | + * @param string $fullName |
|
82 | + * @return Mailcode_Variables_Collection |
|
83 | + */ |
|
84 | 84 | public function getByFullName(string $fullName) : Mailcode_Variables_Collection |
85 | 85 | { |
86 | 86 | $fullName = $this->fixName($fullName); |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | return $collection; |
99 | 99 | } |
100 | 100 | |
101 | - /** |
|
102 | - * Prepends the $ sign to a variable name if it does not have it. |
|
103 | - * |
|
104 | - * @param string $fullName |
|
105 | - * @return string |
|
106 | - */ |
|
101 | + /** |
|
102 | + * Prepends the $ sign to a variable name if it does not have it. |
|
103 | + * |
|
104 | + * @param string $fullName |
|
105 | + * @return string |
|
106 | + */ |
|
107 | 107 | protected function fixName(string $fullName) : string |
108 | 108 | { |
109 | 109 | if(substr($fullName, 0, 1) === '$') |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | return '$'.$fullName; |
115 | 115 | } |
116 | 116 | |
117 | - /** |
|
118 | - * Retrieves all variables, grouped by their hash - meaning |
|
119 | - * unique matched strings. |
|
120 | - * |
|
121 | - * @return Mailcode_Variables_Variable[] |
|
122 | - */ |
|
117 | + /** |
|
118 | + * Retrieves all variables, grouped by their hash - meaning |
|
119 | + * unique matched strings. |
|
120 | + * |
|
121 | + * @return Mailcode_Variables_Variable[] |
|
122 | + */ |
|
123 | 123 | public function getGroupedByHash() : array |
124 | 124 | { |
125 | 125 | $entries = array(); |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | return $this->sortVariables($entries); |
133 | 133 | } |
134 | 134 | |
135 | - /** |
|
136 | - * Retrieves all variables, grouped by their name. |
|
137 | - * |
|
138 | - * @return Mailcode_Variables_Variable[] |
|
139 | - */ |
|
135 | + /** |
|
136 | + * Retrieves all variables, grouped by their name. |
|
137 | + * |
|
138 | + * @return Mailcode_Variables_Variable[] |
|
139 | + */ |
|
140 | 140 | public function getGroupedByName() : array |
141 | 141 | { |
142 | 142 | $entries = array(); |
@@ -168,19 +168,19 @@ discard block |
||
168 | 168 | return $this->sortVariables($entries); |
169 | 169 | } |
170 | 170 | |
171 | - /** |
|
172 | - * Retrieves all variables, in the order they were addded. |
|
173 | - * @return Mailcode_Variables_Variable[] |
|
174 | - */ |
|
171 | + /** |
|
172 | + * Retrieves all variables, in the order they were addded. |
|
173 | + * @return Mailcode_Variables_Variable[] |
|
174 | + */ |
|
175 | 175 | public function getAll() |
176 | 176 | { |
177 | 177 | return $this->variables; |
178 | 178 | } |
179 | 179 | |
180 | - /** |
|
181 | - * Retrieves the full names of the variables that are present in the collection. |
|
182 | - * @return string[] |
|
183 | - */ |
|
180 | + /** |
|
181 | + * Retrieves the full names of the variables that are present in the collection. |
|
182 | + * @return string[] |
|
183 | + */ |
|
184 | 184 | public function getNames() : array |
185 | 185 | { |
186 | 186 | $result = array(); |
@@ -198,13 +198,13 @@ discard block |
||
198 | 198 | return $result; |
199 | 199 | } |
200 | 200 | |
201 | - /** |
|
202 | - * Takes a list of variables and sorts them, throwing away |
|
203 | - * the source array's keys. |
|
204 | - * |
|
205 | - * @param Mailcode_Variables_Variable[] $entries |
|
206 | - * @return Mailcode_Variables_Variable[] |
|
207 | - */ |
|
201 | + /** |
|
202 | + * Takes a list of variables and sorts them, throwing away |
|
203 | + * the source array's keys. |
|
204 | + * |
|
205 | + * @param Mailcode_Variables_Variable[] $entries |
|
206 | + * @return Mailcode_Variables_Variable[] |
|
207 | + */ |
|
208 | 208 | protected function sortVariables(array $entries) |
209 | 209 | { |
210 | 210 | $result = array_values($entries); |
@@ -217,13 +217,13 @@ discard block |
||
217 | 217 | return $result; |
218 | 218 | } |
219 | 219 | |
220 | - /** |
|
221 | - * Merges the variables collection with the target collection |
|
222 | - * by inheriting all that collection's variables. |
|
223 | - * |
|
224 | - * @param Mailcode_Variables_Collection $collection |
|
225 | - * @return Mailcode_Variables_Collection |
|
226 | - */ |
|
220 | + /** |
|
221 | + * Merges the variables collection with the target collection |
|
222 | + * by inheriting all that collection's variables. |
|
223 | + * |
|
224 | + * @param Mailcode_Variables_Collection $collection |
|
225 | + * @return Mailcode_Variables_Collection |
|
226 | + */ |
|
227 | 227 | public function mergeWith(Mailcode_Variables_Collection $collection) : Mailcode_Variables_Collection |
228 | 228 | { |
229 | 229 | $variables = $collection->getGroupedByHash(); |
@@ -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; |
@@ -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 |