@@ -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,12 +50,12 @@ discard block |
||
50 | 50 | return $cmd; |
51 | 51 | } |
52 | 52 | |
53 | - /** |
|
54 | - * Creates a ShowSnippet command. |
|
55 | - * |
|
56 | - * @param string $snippetName A snippet name, with or without the $ sign prepended. |
|
57 | - * @return Mailcode_Commands_Command_ShowSnippet |
|
58 | - */ |
|
53 | + /** |
|
54 | + * Creates a ShowSnippet command. |
|
55 | + * |
|
56 | + * @param string $snippetName A snippet name, with or without the $ sign prepended. |
|
57 | + * @return Mailcode_Commands_Command_ShowSnippet |
|
58 | + */ |
|
59 | 59 | public static function showSnippet(string $snippetName) : Mailcode_Commands_Command_ShowSnippet |
60 | 60 | { |
61 | 61 | $snippetName = self::_filterVariableName($snippetName); |
@@ -71,17 +71,17 @@ discard block |
||
71 | 71 | return $cmd; |
72 | 72 | } |
73 | 73 | |
74 | - /** |
|
75 | - * Creates a SetVariable command. |
|
76 | - * |
|
77 | - * @param string $variableName A variable name, with or without the $ sign prepended. |
|
78 | - * @param string $value |
|
79 | - * @param bool $quoteValue Whether to treat the value as a string literal, and add quotes to it. |
|
80 | - * @return Mailcode_Commands_Command_SetVariable |
|
81 | - * @throws Mailcode_Factory_Exception |
|
82 | - * |
|
83 | - * @see Mailcode_Factory::ERROR_INVALID_COMMAND_CREATED |
|
84 | - */ |
|
74 | + /** |
|
75 | + * Creates a SetVariable command. |
|
76 | + * |
|
77 | + * @param string $variableName A variable name, with or without the $ sign prepended. |
|
78 | + * @param string $value |
|
79 | + * @param bool $quoteValue Whether to treat the value as a string literal, and add quotes to it. |
|
80 | + * @return Mailcode_Commands_Command_SetVariable |
|
81 | + * @throws Mailcode_Factory_Exception |
|
82 | + * |
|
83 | + * @see Mailcode_Factory::ERROR_INVALID_COMMAND_CREATED |
|
84 | + */ |
|
85 | 85 | public static function setVar(string $variableName, string $value, bool $quoteValue=true) : Mailcode_Commands_Command_SetVariable |
86 | 86 | { |
87 | 87 | $variableName = self::_filterVariableName($variableName); |
@@ -104,14 +104,14 @@ discard block |
||
104 | 104 | return $cmd; |
105 | 105 | } |
106 | 106 | |
107 | - /** |
|
108 | - * Like setVar(), but treats the value as a string literal |
|
109 | - * and automatically adds quotes to it. |
|
110 | - * |
|
111 | - * @param string $variableName |
|
112 | - * @param string $value |
|
113 | - * @return Mailcode_Commands_Command_SetVariable |
|
114 | - */ |
|
107 | + /** |
|
108 | + * Like setVar(), but treats the value as a string literal |
|
109 | + * and automatically adds quotes to it. |
|
110 | + * |
|
111 | + * @param string $variableName |
|
112 | + * @param string $value |
|
113 | + * @return Mailcode_Commands_Command_SetVariable |
|
114 | + */ |
|
115 | 115 | public static function setVarString(string $variableName, string $value) : Mailcode_Commands_Command_SetVariable |
116 | 116 | { |
117 | 117 | return self::setVar($variableName, $value, true); |
@@ -378,12 +378,12 @@ discard block |
||
378 | 378 | return '$'.ltrim($name, '$'); |
379 | 379 | } |
380 | 380 | |
381 | - /** |
|
382 | - * Quotes a string literal: adds the quotes, and escapes any quotes already present in it. |
|
383 | - * |
|
384 | - * @param string $string |
|
385 | - * @return string |
|
386 | - */ |
|
381 | + /** |
|
382 | + * Quotes a string literal: adds the quotes, and escapes any quotes already present in it. |
|
383 | + * |
|
384 | + * @param string $string |
|
385 | + * @return string |
|
386 | + */ |
|
387 | 387 | protected static function _quoteString(string $string) : string |
388 | 388 | { |
389 | 389 | return '"'.str_replace('"', '\"', $string).'"'; |
@@ -416,23 +416,23 @@ discard block |
||
416 | 416 | ); |
417 | 417 | } |
418 | 418 | |
419 | - /** |
|
420 | - * Creates a renderer instance, which can be used to easily |
|
421 | - * create and convert commands to strings. |
|
422 | - * |
|
423 | - * @return Mailcode_Renderer |
|
424 | - */ |
|
419 | + /** |
|
420 | + * Creates a renderer instance, which can be used to easily |
|
421 | + * create and convert commands to strings. |
|
422 | + * |
|
423 | + * @return Mailcode_Renderer |
|
424 | + */ |
|
425 | 425 | public static function createRenderer() : Mailcode_Renderer |
426 | 426 | { |
427 | 427 | return new Mailcode_Renderer(); |
428 | 428 | } |
429 | 429 | |
430 | - /** |
|
431 | - * Creates a printer instance, which works like the renderer, |
|
432 | - * but outputs the generated strings to standard output. |
|
433 | - * |
|
434 | - * @return Mailcode_Printer |
|
435 | - */ |
|
430 | + /** |
|
431 | + * Creates a printer instance, which works like the renderer, |
|
432 | + * but outputs the generated strings to standard output. |
|
433 | + * |
|
434 | + * @return Mailcode_Printer |
|
435 | + */ |
|
436 | 436 | public static function createPrinter() : Mailcode_Printer |
437 | 437 | { |
438 | 438 | return new Mailcode_Printer(); |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | { |
25 | 25 | const ERROR_CANNOT_RETRIEVE_FIRST_ERROR = 52301; |
26 | 26 | |
27 | - /** |
|
28 | - * @var Mailcode_Commands_Command[] |
|
29 | - */ |
|
27 | + /** |
|
28 | + * @var Mailcode_Commands_Command[] |
|
29 | + */ |
|
30 | 30 | protected $commands = array(); |
31 | 31 | |
32 | 32 | /** |
@@ -34,17 +34,17 @@ discard block |
||
34 | 34 | */ |
35 | 35 | protected $errors = array(); |
36 | 36 | |
37 | - /** |
|
38 | - * @var OperationResult|NULL |
|
39 | - */ |
|
37 | + /** |
|
38 | + * @var OperationResult|NULL |
|
39 | + */ |
|
40 | 40 | protected $validationResult; |
41 | 41 | |
42 | - /** |
|
43 | - * Adds a command to the collection. |
|
44 | - * |
|
45 | - * @param Mailcode_Commands_Command $command |
|
46 | - * @return Mailcode_Collection |
|
47 | - */ |
|
42 | + /** |
|
43 | + * Adds a command to the collection. |
|
44 | + * |
|
45 | + * @param Mailcode_Commands_Command $command |
|
46 | + * @return Mailcode_Collection |
|
47 | + */ |
|
48 | 48 | public function addCommand(Mailcode_Commands_Command $command) : Mailcode_Collection |
49 | 49 | { |
50 | 50 | $this->commands[] = $command; |
@@ -56,21 +56,21 @@ discard block |
||
56 | 56 | return $this; |
57 | 57 | } |
58 | 58 | |
59 | - /** |
|
60 | - * Whether there are any commands in the collection. |
|
61 | - * |
|
62 | - * @return bool |
|
63 | - */ |
|
59 | + /** |
|
60 | + * Whether there are any commands in the collection. |
|
61 | + * |
|
62 | + * @return bool |
|
63 | + */ |
|
64 | 64 | public function hasCommands() : bool |
65 | 65 | { |
66 | 66 | return !empty($this->commands); |
67 | 67 | } |
68 | 68 | |
69 | - /** |
|
70 | - * Counts the amount of commands in the collection. |
|
71 | - * |
|
72 | - * @return int |
|
73 | - */ |
|
69 | + /** |
|
70 | + * Counts the amount of commands in the collection. |
|
71 | + * |
|
72 | + * @return int |
|
73 | + */ |
|
74 | 74 | public function countCommands() : int |
75 | 75 | { |
76 | 76 | return count($this->commands); |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | $this->errors[] = new Mailcode_Collection_Error_Command($command); |
91 | 91 | } |
92 | 92 | |
93 | - /** |
|
94 | - * @return Mailcode_Collection_Error[] |
|
95 | - */ |
|
93 | + /** |
|
94 | + * @return Mailcode_Collection_Error[] |
|
95 | + */ |
|
96 | 96 | public function getErrors() |
97 | 97 | { |
98 | 98 | $result = $this->getValidationResult(); |
@@ -134,25 +134,25 @@ discard block |
||
134 | 134 | return empty($errors); |
135 | 135 | } |
136 | 136 | |
137 | - /** |
|
138 | - * Retrieves all commands that were detected, in the exact order |
|
139 | - * they were found. |
|
140 | - * |
|
141 | - * @return \Mailcode\Mailcode_Commands_Command[] |
|
142 | - */ |
|
137 | + /** |
|
138 | + * Retrieves all commands that were detected, in the exact order |
|
139 | + * they were found. |
|
140 | + * |
|
141 | + * @return \Mailcode\Mailcode_Commands_Command[] |
|
142 | + */ |
|
143 | 143 | public function getCommands() |
144 | 144 | { |
145 | - return $this->commands; |
|
145 | + return $this->commands; |
|
146 | 146 | } |
147 | 147 | |
148 | - /** |
|
149 | - * Retrieves all unique commands by their matched |
|
150 | - * string hash: this ensures only commands that were |
|
151 | - * written the exact same way (including spacing) |
|
152 | - * are returned. |
|
153 | - * |
|
154 | - * @return \Mailcode\Mailcode_Commands_Command[] |
|
155 | - */ |
|
148 | + /** |
|
149 | + * Retrieves all unique commands by their matched |
|
150 | + * string hash: this ensures only commands that were |
|
151 | + * written the exact same way (including spacing) |
|
152 | + * are returned. |
|
153 | + * |
|
154 | + * @return \Mailcode\Mailcode_Commands_Command[] |
|
155 | + */ |
|
156 | 156 | public function getGroupedByHash() |
157 | 157 | { |
158 | 158 | $hashes = array(); |
@@ -170,12 +170,12 @@ discard block |
||
170 | 170 | return array_values($hashes); |
171 | 171 | } |
172 | 172 | |
173 | - /** |
|
174 | - * Adds several commands at once. |
|
175 | - * |
|
176 | - * @param Mailcode_Commands_Command[] $commands |
|
177 | - * @return Mailcode_Collection |
|
178 | - */ |
|
173 | + /** |
|
174 | + * Adds several commands at once. |
|
175 | + * |
|
176 | + * @param Mailcode_Commands_Command[] $commands |
|
177 | + * @return Mailcode_Collection |
|
178 | + */ |
|
179 | 179 | public function addCommands(array $commands) : Mailcode_Collection |
180 | 180 | { |
181 | 181 | foreach($commands as $command) |
@@ -234,11 +234,11 @@ discard block |
||
234 | 234 | return false; |
235 | 235 | } |
236 | 236 | |
237 | - /** |
|
238 | - * Retrieves only show variable commands in the collection, if any. |
|
239 | - * |
|
240 | - * @return \Mailcode\Mailcode_Commands_Command_ShowVariable[] |
|
241 | - */ |
|
237 | + /** |
|
238 | + * Retrieves only show variable commands in the collection, if any. |
|
239 | + * |
|
240 | + * @return \Mailcode\Mailcode_Commands_Command_ShowVariable[] |
|
241 | + */ |
|
242 | 242 | public function getShowVariableCommands() |
243 | 243 | { |
244 | 244 | $result = array(); |