@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | ->getInfo() |
44 | 44 | ->getStringLiterals(); |
45 | 45 | |
46 | - foreach($literals as $literal) |
|
46 | + foreach ($literals as $literal) |
|
47 | 47 | { |
48 | 48 | $text = $literal->getText(); |
49 | 49 | |
50 | - if(strpos($text, '=') !== false && $this->analyzeQueryString($text)) |
|
50 | + if (strpos($text, '=') !== false && $this->analyzeQueryString($text)) |
|
51 | 51 | { |
52 | 52 | $this->queryParamTokens[] = $literal; |
53 | 53 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | public function getQueryParam(string $name) : string |
90 | 90 | { |
91 | - if(isset($this->queryParams[$name])) |
|
91 | + if (isset($this->queryParams[$name])) |
|
92 | 92 | { |
93 | 93 | return $this->queryParams[$name]; |
94 | 94 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | ->getInfo() |
62 | 62 | ->getStringLiterals(); |
63 | 63 | |
64 | - if(empty($literals)) |
|
64 | + if (empty($literals)) |
|
65 | 65 | { |
66 | 66 | return; |
67 | 67 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | $id = $trackingID->getText(); |
72 | 72 | |
73 | - if(strpos($id, '=') === false) |
|
73 | + if (strpos($id, '=') === false) |
|
74 | 74 | { |
75 | 75 | $this->trackingID = $id; |
76 | 76 | $this->trackingIDToken = $trackingID; |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | $this->noTrackingToken = null; |
56 | 56 | $this->trackingEnabled = true; |
57 | 57 | |
58 | - foreach($keywords as $keyword) |
|
58 | + foreach ($keywords as $keyword) |
|
59 | 59 | { |
60 | - if($keyword->getKeyword() === Mailcode_Commands_Keywords::TYPE_NO_TRACKING) |
|
60 | + if ($keyword->getKeyword() === Mailcode_Commands_Keywords::TYPE_NO_TRACKING) |
|
61 | 61 | { |
62 | 62 | $this->noTrackingToken = $keyword; |
63 | 63 | $this->trackingEnabled = false; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | public function getNoTrackingToken() : ?Mailcode_Parser_Statement_Tokenizer_Token_Keyword |
91 | 91 | { |
92 | - if($this->noTrackingToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
92 | + if ($this->noTrackingToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
93 | 93 | { |
94 | 94 | return $this->noTrackingToken; |
95 | 95 | } |
@@ -28,21 +28,21 @@ discard block |
||
28 | 28 | public const ERROR_INVALID_DUMMY_COMMAND_TYPE = 45903; |
29 | 29 | public const ERROR_INVALID_COMMAND_CLASS = 45904; |
30 | 30 | |
31 | - /** |
|
32 | - * @var Mailcode_Commands_Command[] |
|
33 | - */ |
|
31 | + /** |
|
32 | + * @var Mailcode_Commands_Command[] |
|
33 | + */ |
|
34 | 34 | private array $commands = array(); |
35 | 35 | |
36 | - /** |
|
37 | - * @var array<string,Mailcode_Commands_Command> |
|
38 | - */ |
|
36 | + /** |
|
37 | + * @var array<string,Mailcode_Commands_Command> |
|
38 | + */ |
|
39 | 39 | private static array $dummyCommands = array(); |
40 | 40 | |
41 | - /** |
|
42 | - * Retrieves a list of all available command IDs. |
|
43 | - * |
|
44 | - * @return string[] |
|
45 | - */ |
|
41 | + /** |
|
42 | + * Retrieves a list of all available command IDs. |
|
43 | + * |
|
44 | + * @return string[] |
|
45 | + */ |
|
46 | 46 | public function getIDs() : array |
47 | 47 | { |
48 | 48 | static $ids = array(); |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | return $result; |
89 | 89 | } |
90 | 90 | |
91 | - /** |
|
92 | - * Gets an available command by its ID. |
|
93 | - * |
|
94 | - * @param string $id |
|
95 | - * @return Mailcode_Commands_Command |
|
96 | - */ |
|
91 | + /** |
|
92 | + * Gets an available command by its ID. |
|
93 | + * |
|
94 | + * @param string $id |
|
95 | + * @return Mailcode_Commands_Command |
|
96 | + */ |
|
97 | 97 | public function getByID(string $id) : Mailcode_Commands_Command |
98 | 98 | { |
99 | 99 | static $instances = array(); |
@@ -106,15 +106,15 @@ discard block |
||
106 | 106 | return $instances[$id]; |
107 | 107 | } |
108 | 108 | |
109 | - /** |
|
110 | - * Retrieves the ID of a command by its name. |
|
111 | - * |
|
112 | - * @param string $name |
|
113 | - * @throws Mailcode_Exception |
|
114 | - * @return string |
|
115 | - * |
|
116 | - * @see Mailcode_Commands::ERROR_COMMAND_NAME_DOES_NOT_EXIST |
|
117 | - */ |
|
109 | + /** |
|
110 | + * Retrieves the ID of a command by its name. |
|
111 | + * |
|
112 | + * @param string $name |
|
113 | + * @throws Mailcode_Exception |
|
114 | + * @return string |
|
115 | + * |
|
116 | + * @see Mailcode_Commands::ERROR_COMMAND_NAME_DOES_NOT_EXIST |
|
117 | + */ |
|
118 | 118 | public function getIDByName(string $name) : string |
119 | 119 | { |
120 | 120 | $items = $this->getAll(); |
@@ -143,12 +143,12 @@ discard block |
||
143 | 143 | return in_array($id, $ids); |
144 | 144 | } |
145 | 145 | |
146 | - /** |
|
147 | - * Checks wether the specified name exists. |
|
148 | - * |
|
149 | - * @param string $name For example: "showvar". |
|
150 | - * @return bool |
|
151 | - */ |
|
146 | + /** |
|
147 | + * Checks wether the specified name exists. |
|
148 | + * |
|
149 | + * @param string $name For example: "showvar". |
|
150 | + * @return bool |
|
151 | + */ |
|
152 | 152 | public function nameExists(string $name) : bool |
153 | 153 | { |
154 | 154 | $items = $this->getAll(); |
@@ -216,14 +216,14 @@ discard block |
||
216 | 216 | return $class; |
217 | 217 | } |
218 | 218 | |
219 | - /** |
|
220 | - * Translates the command type to the expected class naming scheme. |
|
221 | - * |
|
222 | - * Example: not-empty => NotEmpty |
|
223 | - * |
|
224 | - * @param string $type |
|
225 | - * @return string |
|
226 | - */ |
|
219 | + /** |
|
220 | + * Translates the command type to the expected class naming scheme. |
|
221 | + * |
|
222 | + * Example: not-empty => NotEmpty |
|
223 | + * |
|
224 | + * @param string $type |
|
225 | + * @return string |
|
226 | + */ |
|
227 | 227 | private function adjustTypeName(string $type) : string |
228 | 228 | { |
229 | 229 | $type = str_replace('-', ' ', $type); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | { |
48 | 48 | static $ids = array(); |
49 | 49 | |
50 | - if(empty($ids)) { |
|
50 | + if (empty($ids)) { |
|
51 | 51 | $ids = FileHelper::createFileFinder(__DIR__.'/Commands/Command') |
52 | 52 | ->getPHPClassNames(); |
53 | 53 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function getAll() : array |
67 | 67 | { |
68 | - if(!empty($this->commands)) { |
|
68 | + if (!empty($this->commands)) { |
|
69 | 69 | return $this->commands; |
70 | 70 | } |
71 | 71 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | $result = array(); |
75 | 75 | |
76 | - foreach($ids as $id) |
|
76 | + foreach ($ids as $id) |
|
77 | 77 | { |
78 | 78 | $result[] = $this->getDummyCommand($id); |
79 | 79 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | { |
99 | 99 | static $instances = array(); |
100 | 100 | |
101 | - if(!isset($instances[$id])) |
|
101 | + if (!isset($instances[$id])) |
|
102 | 102 | { |
103 | 103 | $instances[$id] = $this->createCommand($id, '__dummy', '', ''); |
104 | 104 | } |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | { |
120 | 120 | $items = $this->getAll(); |
121 | 121 | |
122 | - foreach($items as $item) |
|
122 | + foreach ($items as $item) |
|
123 | 123 | { |
124 | - if($item->getName() === $name) { |
|
124 | + if ($item->getName() === $name) { |
|
125 | 125 | return $item->getID(); |
126 | 126 | } |
127 | 127 | } |
@@ -153,9 +153,9 @@ discard block |
||
153 | 153 | { |
154 | 154 | $items = $this->getAll(); |
155 | 155 | |
156 | - foreach($items as $item) |
|
156 | + foreach ($items as $item) |
|
157 | 157 | { |
158 | - if($item->getName() === $name) { |
|
158 | + if ($item->getName() === $name) { |
|
159 | 159 | return true; |
160 | 160 | } |
161 | 161 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | { |
168 | 168 | $class = $this->resolveClassName($id, $type); |
169 | 169 | |
170 | - if(!class_exists($class)) |
|
170 | + if (!class_exists($class)) |
|
171 | 171 | { |
172 | 172 | throw new Mailcode_Exception( |
173 | 173 | 'No such command', |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | $command = new $class($type, $params, $matchedString); |
184 | 184 | |
185 | - if($command instanceof Mailcode_Commands_Command) |
|
185 | + if ($command instanceof Mailcode_Commands_Command) |
|
186 | 186 | { |
187 | 187 | return $command; |
188 | 188 | } |
@@ -203,9 +203,9 @@ discard block |
||
203 | 203 | |
204 | 204 | $dummy = $this->getDummyCommand($id); |
205 | 205 | |
206 | - if($dummy->supportsType()) |
|
206 | + if ($dummy->supportsType()) |
|
207 | 207 | { |
208 | - if(empty($type)) |
|
208 | + if (empty($type)) |
|
209 | 209 | { |
210 | 210 | $type = $dummy->getDefaultType(); |
211 | 211 | } |
@@ -243,14 +243,14 @@ discard block |
||
243 | 243 | */ |
244 | 244 | private function getDummyCommand(string $id) : Mailcode_Commands_Command |
245 | 245 | { |
246 | - if(isset(self::$dummyCommands[$id])) { |
|
246 | + if (isset(self::$dummyCommands[$id])) { |
|
247 | 247 | return self::$dummyCommands[$id]; |
248 | 248 | } |
249 | 249 | |
250 | 250 | $class = 'Mailcode\Mailcode_Commands_Command_'.$id; |
251 | 251 | $cmd = new $class('__dummy'); |
252 | 252 | |
253 | - if($cmd instanceof Mailcode_Commands_Command) |
|
253 | + if ($cmd instanceof Mailcode_Commands_Command) |
|
254 | 254 | { |
255 | 255 | self::$dummyCommands[$id] = $cmd; |
256 | 256 | return $cmd; |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | $result = array(); |
276 | 276 | $commands = $this->getAll(); |
277 | 277 | |
278 | - foreach($commands as $command) |
|
278 | + foreach ($commands as $command) |
|
279 | 279 | { |
280 | - if($command instanceof Mailcode_Interfaces_Commands_ProtectedContent) |
|
280 | + if ($command instanceof Mailcode_Interfaces_Commands_ProtectedContent) |
|
281 | 281 | { |
282 | 282 | $result[] = $command; |
283 | 283 | } |