@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | |
39 | 39 | $keywords = $this->params->getInfo()->getKeywords(); |
40 | 40 | |
41 | - foreach($keywords as $keyword) |
|
41 | + foreach ($keywords as $keyword) |
|
42 | 42 | { |
43 | - if($keyword->isNoHTML()) |
|
43 | + if ($keyword->isNoHTML()) |
|
44 | 44 | { |
45 | 45 | $this->noHTMLToken = $keyword; |
46 | 46 | break; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @return $this |
56 | 56 | * @throws Mailcode_Exception |
57 | 57 | */ |
58 | - public function setHTMLEnabled(bool $enabled=true) : self |
|
58 | + public function setHTMLEnabled(bool $enabled = true) : self |
|
59 | 59 | { |
60 | 60 | $this->params->getInfo()->setKeywordEnabled(Mailcode_Commands_Keywords::TYPE_NOHTML, !$enabled); |
61 | 61 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | ->getInfo() |
38 | 38 | ->getTokenByIndex(0); |
39 | 39 | |
40 | - if($contentIDToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Number) |
|
40 | + if ($contentIDToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Number) |
|
41 | 41 | { |
42 | 42 | $this->contentIDToken = $contentIDToken; |
43 | 43 | $this->loadContent(); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | public function getContentID() : int |
54 | 54 | { |
55 | - if(isset($this->contentIDToken)) |
|
55 | + if (isset($this->contentIDToken)) |
|
56 | 56 | { |
57 | 57 | return (int)$this->contentIDToken->getValue(); |
58 | 58 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | $result = new Mailcode_Parser_ParseResult($collection, $preParser); |
71 | 71 | |
72 | - if(!$collection->isValid()) |
|
72 | + if (!$collection->isValid()) |
|
73 | 73 | { |
74 | 74 | return $result; |
75 | 75 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | $total = count($matches[0]); |
83 | 83 | |
84 | - for($i=0; $i < $total; $i++) |
|
84 | + for ($i = 0; $i < $total; $i++) |
|
85 | 85 | { |
86 | 86 | $match = $this->parseMatch($matches, $i); |
87 | 87 | |
@@ -151,17 +151,17 @@ discard block |
||
151 | 151 | private function handleNesting(Mailcode_Commands_Command $cmd) : void |
152 | 152 | { |
153 | 153 | // Set the command's parent from the stack, if any is present. |
154 | - if(!empty($this->stack)) |
|
154 | + if (!empty($this->stack)) |
|
155 | 155 | { |
156 | 156 | $cmd->setParent($this->getStackLast()); |
157 | 157 | } |
158 | 158 | |
159 | 159 | // Handle opening and closing commands, adding and removing from the stack. |
160 | - if($cmd instanceof Mailcode_Commands_Command_Type_Opening) |
|
160 | + if ($cmd instanceof Mailcode_Commands_Command_Type_Opening) |
|
161 | 161 | { |
162 | 162 | $this->stack[] = $cmd; |
163 | 163 | } |
164 | - else if($cmd instanceof Mailcode_Commands_Command_Type_Closing) |
|
164 | + else if ($cmd instanceof Mailcode_Commands_Command_Type_Closing) |
|
165 | 165 | { |
166 | 166 | array_pop($this->stack); |
167 | 167 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | { |
176 | 176 | $cmd = $this->stack[array_key_last($this->stack)]; |
177 | 177 | |
178 | - if($cmd instanceof Mailcode_Commands_Command) |
|
178 | + if ($cmd instanceof Mailcode_Commands_Command) |
|
179 | 179 | { |
180 | 180 | return $cmd; |
181 | 181 | } |
@@ -204,16 +204,16 @@ discard block |
||
204 | 204 | // 5 = parameter type command, type |
205 | 205 | // 6 = parameter type command, params |
206 | 206 | |
207 | - if(!empty($matches[1][$index])) |
|
207 | + if (!empty($matches[1][$index])) |
|
208 | 208 | { |
209 | 209 | $name = $matches[1][$index]; |
210 | 210 | } |
211 | - else if(!empty($matches[2][$index])) |
|
211 | + else if (!empty($matches[2][$index])) |
|
212 | 212 | { |
213 | 213 | $name = $matches[2][$index]; |
214 | 214 | $params = $matches[3][$index]; |
215 | 215 | } |
216 | - else if(!empty($matches[4][$index])) |
|
216 | + else if (!empty($matches[4][$index])) |
|
217 | 217 | { |
218 | 218 | $name = $matches[4][$index]; |
219 | 219 | $type = $matches[5][$index]; |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | * @param Mailcode_Commands_Command|null $sourceCommand |
251 | 251 | * @return Mailcode_Parser_Statement |
252 | 252 | */ |
253 | - public function createStatement(string $statement, bool $freeform=false, ?Mailcode_Commands_Command $sourceCommand=null) : Mailcode_Parser_Statement |
|
253 | + public function createStatement(string $statement, bool $freeform = false, ?Mailcode_Commands_Command $sourceCommand = null) : Mailcode_Parser_Statement |
|
254 | 254 | { |
255 | 255 | return new Mailcode_Parser_Statement($statement, $freeform, $sourceCommand); |
256 | 256 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $command->getID() |
64 | 64 | ); |
65 | 65 | |
66 | - if(!class_exists($class)) |
|
66 | + if (!class_exists($class)) |
|
67 | 67 | { |
68 | 68 | throw new Mailcode_Translator_Exception( |
69 | 69 | sprintf('Unknown command %s in translator', $command->getID()), |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | $translator = new $class($command); |
79 | 79 | |
80 | - if($translator instanceof Mailcode_Translator_Command) |
|
80 | + if ($translator instanceof Mailcode_Translator_Command) |
|
81 | 81 | { |
82 | 82 | return $translator; |
83 | 83 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | { |
106 | 106 | $subject = $safeguard->makeSafe(); |
107 | 107 | |
108 | - if(!$safeguard->hasPlaceholders()) |
|
108 | + if (!$safeguard->hasPlaceholders()) |
|
109 | 109 | { |
110 | 110 | return $subject; |
111 | 111 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | $replaces = array(); |
116 | 116 | |
117 | - foreach($placeholders as $placeholder) |
|
117 | + foreach ($placeholders as $placeholder) |
|
118 | 118 | { |
119 | 119 | $command = $placeholder->getCommand(); |
120 | 120 |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | $internalFormat = $command->getTranslationParam('internal_format'); |
56 | 56 | |
57 | - if(is_string($internalFormat) && !empty($internalFormat)) |
|
57 | + if (is_string($internalFormat) && !empty($internalFormat)) |
|
58 | 58 | { |
59 | 59 | return $internalFormat; |
60 | 60 | } |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | $chars = ConvertHelper::string2array($formatString); |
84 | 84 | $result = array(); |
85 | 85 | |
86 | - foreach($chars as $char) |
|
86 | + foreach ($chars as $char) |
|
87 | 87 | { |
88 | - if(!isset($this->charTable[$char])) |
|
88 | + if (!isset($this->charTable[$char])) |
|
89 | 89 | { |
90 | 90 | throw new Mailcode_Translator_Exception( |
91 | 91 | 'Unknown date format string character', |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @return Mailcode_Factory_CommandSets_Set_If |
59 | 59 | */ |
60 | - public static function if() : Mailcode_Factory_CommandSets_Set_If |
|
60 | + public static function if () : Mailcode_Factory_CommandSets_Set_If |
|
61 | 61 | { |
62 | 62 | return self::getSets()->if(); |
63 | 63 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @return Mailcode_Factory_CommandSets_Set_ElseIf |
69 | 69 | */ |
70 | - public static function elseIf() : Mailcode_Factory_CommandSets_Set_ElseIf |
|
70 | + public static function elseIf () : Mailcode_Factory_CommandSets_Set_ElseIf |
|
71 | 71 | { |
72 | 72 | return self::getSets()->elseIf(); |
73 | 73 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | protected static function getSets() : Mailcode_Factory_CommandSets |
119 | 119 | { |
120 | - if(!isset(self::$commandSets)) |
|
120 | + if (!isset(self::$commandSets)) |
|
121 | 121 | { |
122 | 122 | self::$commandSets = new Mailcode_Factory_CommandSets(); |
123 | 123 | } |
@@ -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() |
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 | } |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | { |
33 | 33 | $result = array(); |
34 | 34 | |
35 | - foreach($commands as $command) |
|
35 | + foreach ($commands as $command) |
|
36 | 36 | { |
37 | - if($command instanceof Mailcode_Commands_ShowBase) |
|
37 | + if ($command instanceof Mailcode_Commands_ShowBase) |
|
38 | 38 | { |
39 | 39 | $result[] = $command; |
40 | 40 | } |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | { |
57 | 57 | $result = array(); |
58 | 58 | |
59 | - foreach($commands as $command) |
|
59 | + foreach ($commands as $command) |
|
60 | 60 | { |
61 | - if($command instanceof Mailcode_Interfaces_Commands_ListVariables) |
|
61 | + if ($command instanceof Mailcode_Interfaces_Commands_ListVariables) |
|
62 | 62 | { |
63 | 63 | $result[] = $command; |
64 | 64 | } |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | { |
78 | 78 | $result = array(); |
79 | 79 | |
80 | - foreach($commands as $command) |
|
80 | + foreach ($commands as $command) |
|
81 | 81 | { |
82 | - if($command instanceof Mailcode_Commands_Command_ShowVariable) |
|
82 | + if ($command instanceof Mailcode_Commands_Command_ShowVariable) |
|
83 | 83 | { |
84 | 84 | $result[] = $command; |
85 | 85 | } |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | { |
99 | 99 | $result = array(); |
100 | 100 | |
101 | - foreach($commands as $command) |
|
101 | + foreach ($commands as $command) |
|
102 | 102 | { |
103 | - if($command instanceof Mailcode_Commands_Command_For) |
|
103 | + if ($command instanceof Mailcode_Commands_Command_For) |
|
104 | 104 | { |
105 | 105 | $result[] = $command; |
106 | 106 | } |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | { |
120 | 120 | $result = array(); |
121 | 121 | |
122 | - foreach($commands as $command) |
|
122 | + foreach ($commands as $command) |
|
123 | 123 | { |
124 | - if($command instanceof Mailcode_Commands_Command_ShowDate) |
|
124 | + if ($command instanceof Mailcode_Commands_Command_ShowDate) |
|
125 | 125 | { |
126 | 126 | $result[] = $command; |
127 | 127 | } |
@@ -140,9 +140,9 @@ discard block |
||
140 | 140 | { |
141 | 141 | $result = array(); |
142 | 142 | |
143 | - foreach($commands as $command) |
|
143 | + foreach ($commands as $command) |
|
144 | 144 | { |
145 | - if($command instanceof Mailcode_Commands_Command_If) |
|
145 | + if ($command instanceof Mailcode_Commands_Command_If) |
|
146 | 146 | { |
147 | 147 | $result[] = $command; |
148 | 148 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | public function normalize() : string |
39 | 39 | { |
40 | - if(!$this->command->isValid()) |
|
40 | + if (!$this->command->isValid()) |
|
41 | 41 | { |
42 | 42 | return ''; |
43 | 43 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | private function addType() : void |
59 | 59 | { |
60 | - if(!$this->command->supportsType() || !$this->command->hasType()) |
|
60 | + if (!$this->command->supportsType() || !$this->command->hasType()) |
|
61 | 61 | { |
62 | 62 | return; |
63 | 63 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | { |
70 | 70 | $params = $this->getParamsString($command); |
71 | 71 | |
72 | - if(empty($params)) |
|
72 | + if (empty($params)) |
|
73 | 73 | { |
74 | 74 | return; |
75 | 75 | } |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | { |
88 | 88 | $params = $this->getParamsStatement($command); |
89 | 89 | |
90 | - if($params === null) |
|
90 | + if ($params === null) |
|
91 | 91 | { |
92 | 92 | return ''; |
93 | 93 | } |
94 | 94 | |
95 | - if($command->hasFreeformParameters()) |
|
95 | + if ($command->hasFreeformParameters()) |
|
96 | 96 | { |
97 | 97 | return $params->getStatementString(); |
98 | 98 | } |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | |
103 | 103 | private function addLogicKeywords() : void |
104 | 104 | { |
105 | - if(!$this->command->supportsLogicKeywords()) |
|
105 | + if (!$this->command->supportsLogicKeywords()) |
|
106 | 106 | { |
107 | 107 | return; |
108 | 108 | } |
109 | 109 | |
110 | 110 | $keywords = $this->command->getLogicKeywords()->getKeywords(); |
111 | 111 | |
112 | - foreach($keywords as $keyword) |
|
112 | + foreach ($keywords as $keyword) |
|
113 | 113 | { |
114 | 114 | $this->parts[] = ' '; |
115 | 115 | $this->parts[] = $keyword->getKeywordString(); // e.g. "if variable" |