@@ -24,17 +24,17 @@ discard block |
||
24 | 24 | |
25 | 25 | const ERROR_UNEXPECTED_COMMAND_TYPE = 50002; |
26 | 26 | |
27 | - /** |
|
28 | - * @var Mailcode_Renderer |
|
29 | - */ |
|
27 | + /** |
|
28 | + * @var Mailcode_Renderer |
|
29 | + */ |
|
30 | 30 | protected static $renderer; |
31 | 31 | |
32 | - /** |
|
33 | - * Creates a ShowVariable command. |
|
34 | - * |
|
35 | - * @param string $variableName A variable name, with or without the $ sign prepended. |
|
36 | - * @return Mailcode_Commands_Command_ShowVariable |
|
37 | - */ |
|
32 | + /** |
|
33 | + * Creates a ShowVariable command. |
|
34 | + * |
|
35 | + * @param string $variableName A variable name, with or without the $ sign prepended. |
|
36 | + * @return Mailcode_Commands_Command_ShowVariable |
|
37 | + */ |
|
38 | 38 | public static function showVar(string $variableName) : Mailcode_Commands_Command_ShowVariable |
39 | 39 | { |
40 | 40 | $variableName = self::_filterVariableName($variableName); |
@@ -50,17 +50,17 @@ discard block |
||
50 | 50 | return $cmd; |
51 | 51 | } |
52 | 52 | |
53 | - /** |
|
54 | - * Creates a SetVariable command. |
|
55 | - * |
|
56 | - * @param string $variableName A variable name, with or without the $ sign prepended. |
|
57 | - * @param string $value |
|
58 | - * @param bool $quoteValue Whether to treat the value as a string literal, and add quotes to it. |
|
59 | - * @return Mailcode_Commands_Command_SetVariable |
|
60 | - * @throws Mailcode_Factory_Exception |
|
61 | - * |
|
62 | - * @see Mailcode_Factory::ERROR_INVALID_COMMAND_CREATED |
|
63 | - */ |
|
53 | + /** |
|
54 | + * Creates a SetVariable command. |
|
55 | + * |
|
56 | + * @param string $variableName A variable name, with or without the $ sign prepended. |
|
57 | + * @param string $value |
|
58 | + * @param bool $quoteValue Whether to treat the value as a string literal, and add quotes to it. |
|
59 | + * @return Mailcode_Commands_Command_SetVariable |
|
60 | + * @throws Mailcode_Factory_Exception |
|
61 | + * |
|
62 | + * @see Mailcode_Factory::ERROR_INVALID_COMMAND_CREATED |
|
63 | + */ |
|
64 | 64 | public static function setVar(string $variableName, string $value, bool $quoteValue=true) : Mailcode_Commands_Command_SetVariable |
65 | 65 | { |
66 | 66 | $variableName = self::_filterVariableName($variableName); |
@@ -83,14 +83,14 @@ discard block |
||
83 | 83 | return $cmd; |
84 | 84 | } |
85 | 85 | |
86 | - /** |
|
87 | - * Like setVar(), but treats the value as a string literal |
|
88 | - * and automatically adds quotes to it. |
|
89 | - * |
|
90 | - * @param string $variableName |
|
91 | - * @param string $value |
|
92 | - * @return Mailcode_Commands_Command_SetVariable |
|
93 | - */ |
|
86 | + /** |
|
87 | + * Like setVar(), but treats the value as a string literal |
|
88 | + * and automatically adds quotes to it. |
|
89 | + * |
|
90 | + * @param string $variableName |
|
91 | + * @param string $value |
|
92 | + * @return Mailcode_Commands_Command_SetVariable |
|
93 | + */ |
|
94 | 94 | public static function setVarString(string $variableName, string $value) : Mailcode_Commands_Command_SetVariable |
95 | 95 | { |
96 | 96 | return self::setVar($variableName, $value, true); |
@@ -355,12 +355,12 @@ discard block |
||
355 | 355 | return '$'.ltrim($name, '$'); |
356 | 356 | } |
357 | 357 | |
358 | - /** |
|
359 | - * Quotes a string literal: adds the quotes, and escapes any quotes already present in it. |
|
360 | - * |
|
361 | - * @param string $string |
|
362 | - * @return string |
|
363 | - */ |
|
358 | + /** |
|
359 | + * Quotes a string literal: adds the quotes, and escapes any quotes already present in it. |
|
360 | + * |
|
361 | + * @param string $string |
|
362 | + * @return string |
|
363 | + */ |
|
364 | 364 | protected static function _quoteString(string $string) : string |
365 | 365 | { |
366 | 366 | return '"'.str_replace('"', '\"', $string).'"'; |
@@ -393,23 +393,23 @@ discard block |
||
393 | 393 | ); |
394 | 394 | } |
395 | 395 | |
396 | - /** |
|
397 | - * Creates a renderer instance, which can be used to easily |
|
398 | - * create and convert commands to strings. |
|
399 | - * |
|
400 | - * @return Mailcode_Renderer |
|
401 | - */ |
|
396 | + /** |
|
397 | + * Creates a renderer instance, which can be used to easily |
|
398 | + * create and convert commands to strings. |
|
399 | + * |
|
400 | + * @return Mailcode_Renderer |
|
401 | + */ |
|
402 | 402 | public static function createRenderer() : Mailcode_Renderer |
403 | 403 | { |
404 | 404 | return new Mailcode_Renderer(); |
405 | 405 | } |
406 | 406 | |
407 | - /** |
|
408 | - * Creates a printer instance, which works like the renderer, |
|
409 | - * but outputs the generated strings to standard output. |
|
410 | - * |
|
411 | - * @return Mailcode_Printer |
|
412 | - */ |
|
407 | + /** |
|
408 | + * Creates a printer instance, which works like the renderer, |
|
409 | + * but outputs the generated strings to standard output. |
|
410 | + * |
|
411 | + * @return Mailcode_Printer |
|
412 | + */ |
|
413 | 413 | public static function createPrinter() : Mailcode_Printer |
414 | 414 | { |
415 | 415 | return new Mailcode_Printer(); |
@@ -30,53 +30,53 @@ discard block |
||
30 | 30 | const VALIDATION_UNKNOWN_COMMAND_NAME = 48304; |
31 | 31 | const VALIDATION_INVALID_PARAMS_STATEMENT = 48305; |
32 | 32 | |
33 | - /** |
|
34 | - * @var string |
|
35 | - */ |
|
33 | + /** |
|
34 | + * @var string |
|
35 | + */ |
|
36 | 36 | protected $type = ''; |
37 | 37 | |
38 | - /** |
|
39 | - * @var string |
|
40 | - */ |
|
38 | + /** |
|
39 | + * @var string |
|
40 | + */ |
|
41 | 41 | protected $paramsString = ''; |
42 | 42 | |
43 | - /** |
|
44 | - * @var string |
|
45 | - */ |
|
43 | + /** |
|
44 | + * @var string |
|
45 | + */ |
|
46 | 46 | protected $matchedText = ''; |
47 | 47 | |
48 | - /** |
|
49 | - * @var string |
|
50 | - */ |
|
48 | + /** |
|
49 | + * @var string |
|
50 | + */ |
|
51 | 51 | protected $hash = ''; |
52 | 52 | |
53 | - /** |
|
54 | - * @var \AppUtils\OperationResult |
|
55 | - */ |
|
53 | + /** |
|
54 | + * @var \AppUtils\OperationResult |
|
55 | + */ |
|
56 | 56 | protected $validationResult = null; |
57 | 57 | |
58 | - /** |
|
59 | - * @var \Mailcode\Mailcode |
|
60 | - */ |
|
58 | + /** |
|
59 | + * @var \Mailcode\Mailcode |
|
60 | + */ |
|
61 | 61 | protected $mailcode; |
62 | 62 | |
63 | - /** |
|
64 | - * @var \Mailcode\Mailcode_Parser_Statement |
|
65 | - */ |
|
63 | + /** |
|
64 | + * @var \Mailcode\Mailcode_Parser_Statement |
|
65 | + */ |
|
66 | 66 | protected $params; |
67 | 67 | |
68 | - /** |
|
69 | - * @var string[] |
|
70 | - */ |
|
68 | + /** |
|
69 | + * @var string[] |
|
70 | + */ |
|
71 | 71 | protected $validations = array( |
72 | 72 | 'params', |
73 | 73 | 'type_supported', |
74 | 74 | 'type_unsupported' |
75 | 75 | ); |
76 | 76 | |
77 | - /** |
|
78 | - * @var string |
|
79 | - */ |
|
77 | + /** |
|
78 | + * @var string |
|
79 | + */ |
|
80 | 80 | protected $comment = ''; |
81 | 81 | |
82 | 82 | public function __construct(string $type='', string $paramsString='', string $matchedText='') |
@@ -94,23 +94,23 @@ discard block |
||
94 | 94 | |
95 | 95 | } |
96 | 96 | |
97 | - /** |
|
98 | - * @return string The ID of the command = the name of the command class file. |
|
99 | - */ |
|
97 | + /** |
|
98 | + * @return string The ID of the command = the name of the command class file. |
|
99 | + */ |
|
100 | 100 | public function getID() : string |
101 | 101 | { |
102 | 102 | $tokens = explode('_', get_class($this)); |
103 | 103 | return array_pop($tokens); |
104 | 104 | } |
105 | 105 | |
106 | - /** |
|
107 | - * Sets an optional comment that is not used anywhere, but |
|
108 | - * can be used by the application to track why a command is |
|
109 | - * used somewhere. |
|
110 | - * |
|
111 | - * @param string $comment |
|
112 | - * @return Mailcode_Commands_Command |
|
113 | - */ |
|
106 | + /** |
|
107 | + * Sets an optional comment that is not used anywhere, but |
|
108 | + * can be used by the application to track why a command is |
|
109 | + * used somewhere. |
|
110 | + * |
|
111 | + * @param string $comment |
|
112 | + * @return Mailcode_Commands_Command |
|
113 | + */ |
|
114 | 114 | public function setComment(string $comment) : Mailcode_Commands_Command |
115 | 115 | { |
116 | 116 | $this->comment = $comment; |
@@ -118,34 +118,34 @@ discard block |
||
118 | 118 | return $this; |
119 | 119 | } |
120 | 120 | |
121 | - /** |
|
122 | - * Retrieves the previously set comment, if any. |
|
123 | - * |
|
124 | - * @return string |
|
125 | - */ |
|
121 | + /** |
|
122 | + * Retrieves the previously set comment, if any. |
|
123 | + * |
|
124 | + * @return string |
|
125 | + */ |
|
126 | 126 | public function getComment() : string |
127 | 127 | { |
128 | 128 | return $this->comment; |
129 | 129 | } |
130 | 130 | |
131 | - /** |
|
132 | - * Checks whether this is a dummy command, which is only |
|
133 | - * used to access information on the command type. It cannot |
|
134 | - * be used as an actual live command. |
|
135 | - * |
|
136 | - * @return bool |
|
137 | - */ |
|
131 | + /** |
|
132 | + * Checks whether this is a dummy command, which is only |
|
133 | + * used to access information on the command type. It cannot |
|
134 | + * be used as an actual live command. |
|
135 | + * |
|
136 | + * @return bool |
|
137 | + */ |
|
138 | 138 | public function isDummy() : bool |
139 | 139 | { |
140 | 140 | return $this->type === '__dummy'; |
141 | 141 | } |
142 | 142 | |
143 | - /** |
|
144 | - * Retrieves a hash of the actual matched command string, |
|
145 | - * which is used in collections to detect duplicate commands. |
|
146 | - * |
|
147 | - * @return string |
|
148 | - */ |
|
143 | + /** |
|
144 | + * Retrieves a hash of the actual matched command string, |
|
145 | + * which is used in collections to detect duplicate commands. |
|
146 | + * |
|
147 | + * @return string |
|
148 | + */ |
|
149 | 149 | public function getHash() : string |
150 | 150 | { |
151 | 151 | $this->requireNonDummy(); |
@@ -237,9 +237,9 @@ discard block |
||
237 | 237 | } |
238 | 238 | } |
239 | 239 | |
240 | - /** |
|
241 | - * @return string[] |
|
242 | - */ |
|
240 | + /** |
|
241 | + * @return string[] |
|
242 | + */ |
|
243 | 243 | abstract protected function getValidations() : array; |
244 | 244 | |
245 | 245 | protected function validateSyntax_params() : void |
@@ -394,22 +394,22 @@ discard block |
||
394 | 394 | return implode('', $parts); |
395 | 395 | } |
396 | 396 | |
397 | - /** |
|
398 | - * Retrieves the names of all the command's supported types: the part |
|
399 | - * between the command name and the colon. Example: {command type: params}. |
|
400 | - * |
|
401 | - * @return string[] |
|
402 | - */ |
|
397 | + /** |
|
398 | + * Retrieves the names of all the command's supported types: the part |
|
399 | + * between the command name and the colon. Example: {command type: params}. |
|
400 | + * |
|
401 | + * @return string[] |
|
402 | + */ |
|
403 | 403 | public function getSupportedTypes() : array |
404 | 404 | { |
405 | 405 | return array(); |
406 | 406 | } |
407 | 407 | |
408 | - /** |
|
409 | - * Retrieves all variable names used in the command. |
|
410 | - * |
|
411 | - * @return Mailcode_Variables_Collection_Regular |
|
412 | - */ |
|
408 | + /** |
|
409 | + * Retrieves all variable names used in the command. |
|
410 | + * |
|
411 | + * @return Mailcode_Variables_Collection_Regular |
|
412 | + */ |
|
413 | 413 | public function getVariables() : Mailcode_Variables_Collection_Regular |
414 | 414 | { |
415 | 415 | return Mailcode::create()->findVariables($this->paramsString); |
@@ -57,45 +57,45 @@ discard block |
||
57 | 57 | |
58 | 58 | const ERROR_PLACEHOLDER_NOT_FOUND = 47804; |
59 | 59 | |
60 | - /** |
|
61 | - * @var Mailcode_Parser |
|
62 | - */ |
|
60 | + /** |
|
61 | + * @var Mailcode_Parser |
|
62 | + */ |
|
63 | 63 | protected $parser; |
64 | 64 | |
65 | - /** |
|
66 | - * @var Mailcode_Collection |
|
67 | - */ |
|
65 | + /** |
|
66 | + * @var Mailcode_Collection |
|
67 | + */ |
|
68 | 68 | protected $commands; |
69 | 69 | |
70 | - /** |
|
71 | - * @var string |
|
72 | - */ |
|
70 | + /** |
|
71 | + * @var string |
|
72 | + */ |
|
73 | 73 | protected $originalString; |
74 | 74 | |
75 | - /** |
|
76 | - * @var Mailcode_Collection |
|
77 | - */ |
|
75 | + /** |
|
76 | + * @var Mailcode_Collection |
|
77 | + */ |
|
78 | 78 | protected $collection; |
79 | 79 | |
80 | - /** |
|
81 | - * Counter for the placeholders, global for all placeholders. |
|
82 | - * @var integer |
|
83 | - */ |
|
80 | + /** |
|
81 | + * Counter for the placeholders, global for all placeholders. |
|
82 | + * @var integer |
|
83 | + */ |
|
84 | 84 | private static $counter = 0; |
85 | 85 | |
86 | - /** |
|
87 | - * @var Mailcode_Parser_Safeguard_Placeholder[] |
|
88 | - */ |
|
86 | + /** |
|
87 | + * @var Mailcode_Parser_Safeguard_Placeholder[] |
|
88 | + */ |
|
89 | 89 | protected $placeholders; |
90 | 90 | |
91 | - /** |
|
92 | - * @var string |
|
93 | - */ |
|
91 | + /** |
|
92 | + * @var string |
|
93 | + */ |
|
94 | 94 | protected $delimiter = '__'; |
95 | 95 | |
96 | - /** |
|
97 | - * @var array|NULL |
|
98 | - */ |
|
96 | + /** |
|
97 | + * @var array|NULL |
|
98 | + */ |
|
99 | 99 | protected $placeholderStrings; |
100 | 100 | |
101 | 101 | public function __construct(Mailcode_Parser $parser, string $subject) |
@@ -104,15 +104,15 @@ discard block |
||
104 | 104 | $this->originalString = $subject; |
105 | 105 | } |
106 | 106 | |
107 | - /** |
|
108 | - * Sets the delimiter character sequence used to prepend |
|
109 | - * and append to the placeholders. |
|
110 | - * |
|
111 | - * The delimiter's default is "__" (two underscores). |
|
112 | - * |
|
113 | - * @param string $delimiter |
|
114 | - * @return Mailcode_Parser_Safeguard |
|
115 | - */ |
|
107 | + /** |
|
108 | + * Sets the delimiter character sequence used to prepend |
|
109 | + * and append to the placeholders. |
|
110 | + * |
|
111 | + * The delimiter's default is "__" (two underscores). |
|
112 | + * |
|
113 | + * @param string $delimiter |
|
114 | + * @return Mailcode_Parser_Safeguard |
|
115 | + */ |
|
116 | 116 | public function setDelimiter(string $delimiter) : Mailcode_Parser_Safeguard |
117 | 117 | { |
118 | 118 | if(empty($delimiter)) |
@@ -134,15 +134,15 @@ discard block |
||
134 | 134 | return $this->delimiter; |
135 | 135 | } |
136 | 136 | |
137 | - /** |
|
138 | - * Retrieves the safe string in which all commands have been replaced |
|
139 | - * by placeholder strings. |
|
140 | - * |
|
141 | - * @return string |
|
142 | - * @throws Mailcode_Exception |
|
143 | - * |
|
144 | - * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
145 | - */ |
|
137 | + /** |
|
138 | + * Retrieves the safe string in which all commands have been replaced |
|
139 | + * by placeholder strings. |
|
140 | + * |
|
141 | + * @return string |
|
142 | + * @throws Mailcode_Exception |
|
143 | + * |
|
144 | + * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
145 | + */ |
|
146 | 146 | public function makeSafe() : string |
147 | 147 | { |
148 | 148 | $this->requireValidCollection(); |
@@ -152,10 +152,10 @@ discard block |
||
152 | 152 | return str_replace(array_values($replaces), array_keys($replaces), $this->originalString); |
153 | 153 | } |
154 | 154 | |
155 | - /** |
|
156 | - * @param bool $highlighted |
|
157 | - * @return string[]string |
|
158 | - */ |
|
155 | + /** |
|
156 | + * @param bool $highlighted |
|
157 | + * @return string[]string |
|
158 | + */ |
|
159 | 159 | protected function getReplaces(bool $highlighted=false) : array |
160 | 160 | { |
161 | 161 | $placeholders = $this->getPlaceholders(); |
@@ -182,12 +182,12 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | |
185 | - /** |
|
186 | - * Retrieves all placeholders that have to be added to |
|
187 | - * the subject text. |
|
188 | - * |
|
189 | - * @return \Mailcode\Mailcode_Parser_Safeguard_Placeholder[] |
|
190 | - */ |
|
185 | + /** |
|
186 | + * Retrieves all placeholders that have to be added to |
|
187 | + * the subject text. |
|
188 | + * |
|
189 | + * @return \Mailcode\Mailcode_Parser_Safeguard_Placeholder[] |
|
190 | + */ |
|
191 | 191 | public function getPlaceholders() |
192 | 192 | { |
193 | 193 | if(isset($this->placeholders)) |
@@ -239,46 +239,46 @@ discard block |
||
239 | 239 | return str_replace($placeholderStrings, array_values($replaces), $string); |
240 | 240 | } |
241 | 241 | |
242 | - /** |
|
243 | - * Makes the string whole again after transforming or filtering it, |
|
244 | - * by replacing the command placeholders with the original commands. |
|
245 | - * |
|
246 | - * @param string $string |
|
247 | - * @return string |
|
248 | - * @throws Mailcode_Exception |
|
249 | - * |
|
250 | - * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
251 | - * @see Mailcode_Parser_Safeguard::ERROR_COMMAND_PLACEHOLDER_MISSING |
|
252 | - */ |
|
242 | + /** |
|
243 | + * Makes the string whole again after transforming or filtering it, |
|
244 | + * by replacing the command placeholders with the original commands. |
|
245 | + * |
|
246 | + * @param string $string |
|
247 | + * @return string |
|
248 | + * @throws Mailcode_Exception |
|
249 | + * |
|
250 | + * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
251 | + * @see Mailcode_Parser_Safeguard::ERROR_COMMAND_PLACEHOLDER_MISSING |
|
252 | + */ |
|
253 | 253 | public function makeWhole(string $string) : string |
254 | 254 | { |
255 | 255 | return $this->restore($string, false); |
256 | 256 | } |
257 | 257 | |
258 | - /** |
|
259 | - * Like makeWhole(), but replaces the commands with a syntax |
|
260 | - * highlighted version, meant for human readable texts only. |
|
261 | - * |
|
262 | - * Note: the commands lose their functionality (They cannot be |
|
263 | - * parsed from that string again). |
|
264 | - * |
|
265 | - * @param string $string |
|
266 | - * @return string |
|
267 | - * @throws Mailcode_Exception |
|
268 | - * |
|
269 | - * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
270 | - * @see Mailcode_Parser_Safeguard::ERROR_COMMAND_PLACEHOLDER_MISSING |
|
271 | - */ |
|
258 | + /** |
|
259 | + * Like makeWhole(), but replaces the commands with a syntax |
|
260 | + * highlighted version, meant for human readable texts only. |
|
261 | + * |
|
262 | + * Note: the commands lose their functionality (They cannot be |
|
263 | + * parsed from that string again). |
|
264 | + * |
|
265 | + * @param string $string |
|
266 | + * @return string |
|
267 | + * @throws Mailcode_Exception |
|
268 | + * |
|
269 | + * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
270 | + * @see Mailcode_Parser_Safeguard::ERROR_COMMAND_PLACEHOLDER_MISSING |
|
271 | + */ |
|
272 | 272 | public function makeHighlighted(string $string) : string |
273 | 273 | { |
274 | 274 | return $this->restore($string, true); |
275 | 275 | } |
276 | 276 | |
277 | - /** |
|
278 | - * Retrieves the commands collection contained in the string. |
|
279 | - * |
|
280 | - * @return Mailcode_Collection |
|
281 | - */ |
|
277 | + /** |
|
278 | + * Retrieves the commands collection contained in the string. |
|
279 | + * |
|
280 | + * @return Mailcode_Collection |
|
281 | + */ |
|
282 | 282 | public function getCollection() : Mailcode_Collection |
283 | 283 | { |
284 | 284 | if(isset($this->collection)) |
@@ -296,11 +296,11 @@ discard block |
||
296 | 296 | return $this->getCollection()->isValid(); |
297 | 297 | } |
298 | 298 | |
299 | - /** |
|
300 | - * @throws Mailcode_Exception |
|
301 | - * |
|
302 | - * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
303 | - */ |
|
299 | + /** |
|
300 | + * @throws Mailcode_Exception |
|
301 | + * |
|
302 | + * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
303 | + */ |
|
304 | 304 | protected function requireValidCollection() : void |
305 | 305 | { |
306 | 306 | if($this->getCollection()->isValid()) |
@@ -318,11 +318,11 @@ discard block |
||
318 | 318 | ); |
319 | 319 | } |
320 | 320 | |
321 | - /** |
|
322 | - * Retrieves a list of all placeholder IDs used in the text. |
|
323 | - * |
|
324 | - * @return string[] |
|
325 | - */ |
|
321 | + /** |
|
322 | + * Retrieves a list of all placeholder IDs used in the text. |
|
323 | + * |
|
324 | + * @return string[] |
|
325 | + */ |
|
326 | 326 | public function getPlaceholderStrings() : array |
327 | 327 | { |
328 | 328 | if(isset($this->placeholderStrings)) |
@@ -349,13 +349,13 @@ discard block |
||
349 | 349 | return in_array($subject, $ids); |
350 | 350 | } |
351 | 351 | |
352 | - /** |
|
353 | - * Retrieves a placeholder instance by its ID. |
|
354 | - * |
|
355 | - * @param int $id |
|
356 | - * @throws Mailcode_Exception If the placeholder was not found. |
|
357 | - * @return Mailcode_Parser_Safeguard_Placeholder |
|
358 | - */ |
|
352 | + /** |
|
353 | + * Retrieves a placeholder instance by its ID. |
|
354 | + * |
|
355 | + * @param int $id |
|
356 | + * @throws Mailcode_Exception If the placeholder was not found. |
|
357 | + * @return Mailcode_Parser_Safeguard_Placeholder |
|
358 | + */ |
|
359 | 359 | public function getPlaceholderByID(int $id) : Mailcode_Parser_Safeguard_Placeholder |
360 | 360 | { |
361 | 361 | $placeholders = $this->getPlaceholders(); |
@@ -378,13 +378,13 @@ discard block |
||
378 | 378 | ); |
379 | 379 | } |
380 | 380 | |
381 | - /** |
|
382 | - * Retrieves a placeholder instance by its replacement text. |
|
383 | - * |
|
384 | - * @param string $string |
|
385 | - * @throws Mailcode_Exception |
|
386 | - * @return Mailcode_Parser_Safeguard_Placeholder |
|
387 | - */ |
|
381 | + /** |
|
382 | + * Retrieves a placeholder instance by its replacement text. |
|
383 | + * |
|
384 | + * @param string $string |
|
385 | + * @throws Mailcode_Exception |
|
386 | + * @return Mailcode_Parser_Safeguard_Placeholder |
|
387 | + */ |
|
388 | 388 | public function getPlaceholderByString(string $string) : Mailcode_Parser_Safeguard_Placeholder |
389 | 389 | { |
390 | 390 | $placeholders = $this->getPlaceholders(); |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | */ |
23 | 23 | class Mailcode_Collection |
24 | 24 | { |
25 | - /** |
|
26 | - * @var Mailcode_Commands_Command[] |
|
27 | - */ |
|
25 | + /** |
|
26 | + * @var Mailcode_Commands_Command[] |
|
27 | + */ |
|
28 | 28 | protected $commands = array(); |
29 | 29 | |
30 | 30 | /** |
@@ -32,17 +32,17 @@ discard block |
||
32 | 32 | */ |
33 | 33 | protected $errors = array(); |
34 | 34 | |
35 | - /** |
|
36 | - * @var OperationResult|NULL |
|
37 | - */ |
|
35 | + /** |
|
36 | + * @var OperationResult|NULL |
|
37 | + */ |
|
38 | 38 | protected $validationResult; |
39 | 39 | |
40 | - /** |
|
41 | - * Adds a command to the collection. |
|
42 | - * |
|
43 | - * @param Mailcode_Commands_Command $command |
|
44 | - * @return Mailcode_Collection |
|
45 | - */ |
|
40 | + /** |
|
41 | + * Adds a command to the collection. |
|
42 | + * |
|
43 | + * @param Mailcode_Commands_Command $command |
|
44 | + * @return Mailcode_Collection |
|
45 | + */ |
|
46 | 46 | public function addCommand(Mailcode_Commands_Command $command) : Mailcode_Collection |
47 | 47 | { |
48 | 48 | $this->commands[] = $command; |
@@ -54,21 +54,21 @@ discard block |
||
54 | 54 | return $this; |
55 | 55 | } |
56 | 56 | |
57 | - /** |
|
58 | - * Whether there are any commands in the collection. |
|
59 | - * |
|
60 | - * @return bool |
|
61 | - */ |
|
57 | + /** |
|
58 | + * Whether there are any commands in the collection. |
|
59 | + * |
|
60 | + * @return bool |
|
61 | + */ |
|
62 | 62 | public function hasCommands() : bool |
63 | 63 | { |
64 | 64 | return !empty($this->commands); |
65 | 65 | } |
66 | 66 | |
67 | - /** |
|
68 | - * Counts the amount of commands in the collection. |
|
69 | - * |
|
70 | - * @return int |
|
71 | - */ |
|
67 | + /** |
|
68 | + * Counts the amount of commands in the collection. |
|
69 | + * |
|
70 | + * @return int |
|
71 | + */ |
|
72 | 72 | public function countCommands() : int |
73 | 73 | { |
74 | 74 | return count($this->commands); |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | $this->errors[] = new Mailcode_Collection_Error_Command($command); |
89 | 89 | } |
90 | 90 | |
91 | - /** |
|
92 | - * @return Mailcode_Collection_Error[] |
|
93 | - */ |
|
91 | + /** |
|
92 | + * @return Mailcode_Collection_Error[] |
|
93 | + */ |
|
94 | 94 | public function getErrors() |
95 | 95 | { |
96 | 96 | $result = $this->getValidationResult(); |
@@ -116,25 +116,25 @@ discard block |
||
116 | 116 | return empty($errors); |
117 | 117 | } |
118 | 118 | |
119 | - /** |
|
120 | - * Retrieves all commands that were detected, in the exact order |
|
121 | - * they were found. |
|
122 | - * |
|
123 | - * @return \Mailcode\Mailcode_Commands_Command[] |
|
124 | - */ |
|
119 | + /** |
|
120 | + * Retrieves all commands that were detected, in the exact order |
|
121 | + * they were found. |
|
122 | + * |
|
123 | + * @return \Mailcode\Mailcode_Commands_Command[] |
|
124 | + */ |
|
125 | 125 | public function getCommands() |
126 | 126 | { |
127 | - return $this->commands; |
|
127 | + return $this->commands; |
|
128 | 128 | } |
129 | 129 | |
130 | - /** |
|
131 | - * Retrieves all unique commands by their matched |
|
132 | - * string hash: this ensures only commands that were |
|
133 | - * written the exact same way (including spacing) |
|
134 | - * are returned. |
|
135 | - * |
|
136 | - * @return \Mailcode\Mailcode_Commands_Command[] |
|
137 | - */ |
|
130 | + /** |
|
131 | + * Retrieves all unique commands by their matched |
|
132 | + * string hash: this ensures only commands that were |
|
133 | + * written the exact same way (including spacing) |
|
134 | + * are returned. |
|
135 | + * |
|
136 | + * @return \Mailcode\Mailcode_Commands_Command[] |
|
137 | + */ |
|
138 | 138 | public function getGroupedByHash() |
139 | 139 | { |
140 | 140 | $hashes = array(); |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | return array_values($hashes); |
153 | 153 | } |
154 | 154 | |
155 | - /** |
|
156 | - * Adds several commands at once. |
|
157 | - * |
|
158 | - * @param Mailcode_Commands_Command[] $commands |
|
159 | - * @return Mailcode_Collection |
|
160 | - */ |
|
155 | + /** |
|
156 | + * Adds several commands at once. |
|
157 | + * |
|
158 | + * @param Mailcode_Commands_Command[] $commands |
|
159 | + * @return Mailcode_Collection |
|
160 | + */ |
|
161 | 161 | public function addCommands(array $commands) : Mailcode_Collection |
162 | 162 | { |
163 | 163 | foreach($commands as $command) |
@@ -216,11 +216,11 @@ discard block |
||
216 | 216 | return false; |
217 | 217 | } |
218 | 218 | |
219 | - /** |
|
220 | - * Retrieves only show variable commands in the collection, if any. |
|
221 | - * |
|
222 | - * @return \Mailcode\Mailcode_Commands_Command_ShowVariable[] |
|
223 | - */ |
|
219 | + /** |
|
220 | + * Retrieves only show variable commands in the collection, if any. |
|
221 | + * |
|
222 | + * @return \Mailcode\Mailcode_Commands_Command_ShowVariable[] |
|
223 | + */ |
|
224 | 224 | public function getShowVariableCommands() |
225 | 225 | { |
226 | 226 | $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::showVar($variableName)); |