@@ -28,14 +28,14 @@ discard block |
||
28 | 28 | '{\s*([a-z]+)\s+([a-z]+)\s*:([^}]*)}' |
29 | 29 | ); |
30 | 30 | |
31 | - /** |
|
32 | - * @var Mailcode |
|
33 | - */ |
|
31 | + /** |
|
32 | + * @var Mailcode |
|
33 | + */ |
|
34 | 34 | protected $mailcode; |
35 | 35 | |
36 | - /** |
|
37 | - * @var Mailcode_Commands |
|
38 | - */ |
|
36 | + /** |
|
37 | + * @var Mailcode_Commands |
|
38 | + */ |
|
39 | 39 | protected $commands; |
40 | 40 | |
41 | 41 | public function __construct(Mailcode $mailcode) |
@@ -44,24 +44,24 @@ discard block |
||
44 | 44 | $this->commands = $this->mailcode->getCommands(); |
45 | 45 | } |
46 | 46 | |
47 | - /** |
|
48 | - * Gets the regex format string used to detect commands. |
|
49 | - * |
|
50 | - * @return string |
|
51 | - */ |
|
47 | + /** |
|
48 | + * Gets the regex format string used to detect commands. |
|
49 | + * |
|
50 | + * @return string |
|
51 | + */ |
|
52 | 52 | protected static function getRegex() : string |
53 | 53 | { |
54 | 54 | return '/'.implode('|', self::COMMAND_REGEX_PARTS).'/sixU'; |
55 | 55 | } |
56 | 56 | |
57 | - /** |
|
58 | - * Parses a string to detect all commands within. Returns a |
|
59 | - * collection instance that contains information on all the |
|
60 | - * commands. |
|
61 | - * |
|
62 | - * @param string $string |
|
63 | - * @return Mailcode_Collection A collection with all unique commands found. |
|
64 | - */ |
|
57 | + /** |
|
58 | + * Parses a string to detect all commands within. Returns a |
|
59 | + * collection instance that contains information on all the |
|
60 | + * commands. |
|
61 | + * |
|
62 | + * @param string $string |
|
63 | + * @return Mailcode_Collection A collection with all unique commands found. |
|
64 | + */ |
|
65 | 65 | public function parseString(string $string) : Mailcode_Collection |
66 | 66 | { |
67 | 67 | $collection = new Mailcode_Collection(); |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | return preg_replace('%<style\b[^>]*>(.*?)</style>%six', '', $subject); |
95 | 95 | } |
96 | 96 | |
97 | - /** |
|
98 | - * Processes a single match found in the string: creates the command, |
|
99 | - * and adds it to the collection if it's a valid command, or to the list |
|
100 | - * of invalid commands otherwise. |
|
101 | - * |
|
102 | - * @param Mailcode_Parser_Match $match |
|
103 | - * @param Mailcode_Collection $collection |
|
104 | - */ |
|
97 | + /** |
|
98 | + * Processes a single match found in the string: creates the command, |
|
99 | + * and adds it to the collection if it's a valid command, or to the list |
|
100 | + * of invalid commands otherwise. |
|
101 | + * |
|
102 | + * @param Mailcode_Parser_Match $match |
|
103 | + * @param Mailcode_Collection $collection |
|
104 | + */ |
|
105 | 105 | protected function processMatch(Mailcode_Parser_Match $match, Mailcode_Collection $collection) : void |
106 | 106 | { |
107 | 107 | $name = $match->getName(); |
@@ -132,14 +132,14 @@ discard block |
||
132 | 132 | $collection->addInvalidCommand($cmd); |
133 | 133 | } |
134 | 134 | |
135 | - /** |
|
136 | - * Parses a single regex match: determines which named group |
|
137 | - * matches, and retrieves the according information. |
|
138 | - * |
|
139 | - * @param array[] $matches The regex results array. |
|
140 | - * @param int $index The matched index. |
|
141 | - * @return Mailcode_Parser_Match |
|
142 | - */ |
|
135 | + /** |
|
136 | + * Parses a single regex match: determines which named group |
|
137 | + * matches, and retrieves the according information. |
|
138 | + * |
|
139 | + * @param array[] $matches The regex results array. |
|
140 | + * @param int $index The matched index. |
|
141 | + * @return Mailcode_Parser_Match |
|
142 | + */ |
|
143 | 143 | protected function parseMatch(array $matches, int $index) : Mailcode_Parser_Match |
144 | 144 | { |
145 | 145 | $name = ''; // the command name, e.g. "showvar" |
@@ -177,26 +177,26 @@ discard block |
||
177 | 177 | ); |
178 | 178 | } |
179 | 179 | |
180 | - /** |
|
181 | - * Creates an instance of the safeguard tool, which |
|
182 | - * is used to safeguard commands in a string with placeholders. |
|
183 | - * |
|
184 | - * @param string $subject The string to use to safeguard commands in. |
|
185 | - * @return Mailcode_Parser_Safeguard |
|
186 | - * @see Mailcode_Parser_Safeguard |
|
187 | - */ |
|
180 | + /** |
|
181 | + * Creates an instance of the safeguard tool, which |
|
182 | + * is used to safeguard commands in a string with placeholders. |
|
183 | + * |
|
184 | + * @param string $subject The string to use to safeguard commands in. |
|
185 | + * @return Mailcode_Parser_Safeguard |
|
186 | + * @see Mailcode_Parser_Safeguard |
|
187 | + */ |
|
188 | 188 | public function createSafeguard(string $subject) : Mailcode_Parser_Safeguard |
189 | 189 | { |
190 | 190 | return new Mailcode_Parser_Safeguard($this, $subject); |
191 | 191 | } |
192 | 192 | |
193 | - /** |
|
194 | - * Creates a statement parser, which is used to validate arbitrary |
|
195 | - * command statements. |
|
196 | - * |
|
197 | - * @param string $statement |
|
198 | - * @return Mailcode_Parser_Statement |
|
199 | - */ |
|
193 | + /** |
|
194 | + * Creates a statement parser, which is used to validate arbitrary |
|
195 | + * command statements. |
|
196 | + * |
|
197 | + * @param string $statement |
|
198 | + * @return Mailcode_Parser_Statement |
|
199 | + */ |
|
200 | 200 | public function createStatement(string $statement) : Mailcode_Parser_Statement |
201 | 201 | { |
202 | 202 | return new Mailcode_Parser_Statement($statement); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | $total = count($matches[0]); |
75 | 75 | |
76 | - for($i=0; $i < $total; $i++) |
|
76 | + for ($i = 0; $i < $total; $i++) |
|
77 | 77 | { |
78 | 78 | $match = $this->parseMatch($matches, $i); |
79 | 79 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | protected function prepareString(string $subject) : string |
87 | 87 | { |
88 | - if(!ConvertHelper::isStringHTML($subject)) |
|
88 | + if (!ConvertHelper::isStringHTML($subject)) |
|
89 | 89 | { |
90 | 90 | return $subject; |
91 | 91 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | { |
107 | 107 | $name = $match->getName(); |
108 | 108 | |
109 | - if(!$this->commands->nameExists($name)) |
|
109 | + if (!$this->commands->nameExists($name)) |
|
110 | 110 | { |
111 | 111 | $collection->addErrorMessage( |
112 | 112 | $match->getMatchedString(), |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $match->getMatchedString() |
124 | 124 | ); |
125 | 125 | |
126 | - if($cmd->isValid()) |
|
126 | + if ($cmd->isValid()) |
|
127 | 127 | { |
128 | 128 | $collection->addCommand($cmd); |
129 | 129 | return; |
@@ -153,16 +153,16 @@ discard block |
||
153 | 153 | // 5 = parameter type command, type |
154 | 154 | // 6 = parameter type command, params |
155 | 155 | |
156 | - if(!empty($matches[1][$index])) |
|
156 | + if (!empty($matches[1][$index])) |
|
157 | 157 | { |
158 | 158 | $name = $matches[1][$index]; |
159 | 159 | } |
160 | - else if(!empty($matches[2][$index])) |
|
160 | + else if (!empty($matches[2][$index])) |
|
161 | 161 | { |
162 | 162 | $name = $matches[2][$index]; |
163 | 163 | $params = $matches[3][$index]; |
164 | 164 | } |
165 | - else if(!empty($matches[4][$index])) |
|
165 | + else if (!empty($matches[4][$index])) |
|
166 | 166 | { |
167 | 167 | $name = $matches[4][$index]; |
168 | 168 | $type = $matches[5][$index]; |