@@ -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 | } |
@@ -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" |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | public function __construct(Mailcode_Commands_Command $command) |
41 | 41 | { |
42 | - if(!$command instanceof Mailcode_Interfaces_Commands_ProtectedContent) |
|
42 | + if (!$command instanceof Mailcode_Interfaces_Commands_ProtectedContent) |
|
43 | 43 | { |
44 | 44 | throw new Mailcode_Exception( |
45 | 45 | 'Invalid command', |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | { |
67 | 67 | $params = $command->getParams(); |
68 | 68 | |
69 | - if($params === null) |
|
69 | + if ($params === null) |
|
70 | 70 | { |
71 | 71 | return null; |
72 | 72 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | $contentID = $info->getTokenByIndex(0); |
92 | 92 | |
93 | - if($contentID instanceof Mailcode_Parser_Statement_Tokenizer_Token_Number) |
|
93 | + if ($contentID instanceof Mailcode_Parser_Statement_Tokenizer_Token_Number) |
|
94 | 94 | { |
95 | 95 | $info->removeToken($contentID); |
96 | 96 | return $copy; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | { |
79 | 79 | $val = $this->getValidator()->createVariable()->setIndex(0); |
80 | 80 | |
81 | - if($val->isValid()) |
|
81 | + if ($val->isValid()) |
|
82 | 82 | { |
83 | 83 | $this->variableToken = $val->getToken(); |
84 | 84 | } |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | ->limitToOperands() |
100 | 100 | ->getTokens(); |
101 | 101 | |
102 | - foreach($tokens as $token) |
|
102 | + foreach ($tokens as $token) |
|
103 | 103 | { |
104 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
104 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
105 | 105 | { |
106 | 106 | $this->validateOperand($token); |
107 | 107 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | // ensure that the operand we have in the command is one of the |
119 | 119 | // allowed ones. |
120 | - if(!in_array($sign, $allowed)) |
|
120 | + if (!in_array($sign, $allowed)) |
|
121 | 121 | { |
122 | 122 | $this->validationResult->makeError( |
123 | 123 | t('The %1$s sign is not allowed in this command.', '<code>'.$sign.'</code>'), |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | { |
131 | 131 | $tokens = $this->getAssignmentTokens(); |
132 | 132 | |
133 | - if(empty($tokens)) |
|
133 | + if (empty($tokens)) |
|
134 | 134 | { |
135 | 135 | $this->validationResult->makeError( |
136 | 136 | t('No value assigned to the variable.'), |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | public function getVariable() : Mailcode_Variables_Variable |
143 | 143 | { |
144 | - if($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
144 | + if ($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
145 | 145 | { |
146 | 146 | return $this->variableToken->getVariable(); |
147 | 147 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $eq = array_shift($params); // equals sign |
166 | 166 | |
167 | 167 | // in case the equals sign was omitted. |
168 | - if($eq !== null && !$eq instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
168 | + if ($eq !== null && !$eq instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
169 | 169 | { |
170 | 170 | array_unshift($params, $eq); |
171 | 171 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | |
180 | 180 | $items = array(); |
181 | 181 | |
182 | - foreach($tokens as $token) |
|
182 | + foreach ($tokens as $token) |
|
183 | 183 | { |
184 | 184 | $items[] = $token->getNormalized(); |
185 | 185 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function getSyntaxName() : string |
113 | 113 | { |
114 | - if(isset($this->langToken)) |
|
114 | + if (isset($this->langToken)) |
|
115 | 115 | { |
116 | 116 | return $this->langToken->getText(); |
117 | 117 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | ->getInfo() |
135 | 135 | ->getStringLiteralByIndex(1); |
136 | 136 | |
137 | - if($lang) |
|
137 | + if ($lang) |
|
138 | 138 | { |
139 | 139 | $this->langToken = $lang; |
140 | 140 | return; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | { |
159 | 159 | // To keep PHPStan happy. If no token has been found, this |
160 | 160 | // method will not be called. |
161 | - if(!isset($this->langToken)) |
|
161 | + if (!isset($this->langToken)) |
|
162 | 162 | { |
163 | 163 | return; |
164 | 164 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $name = $this->langToken->getText(); |
167 | 167 | $supported = self::getSupportedSyntaxes(); |
168 | 168 | |
169 | - if(in_array($name, $supported)) |
|
169 | + if (in_array($name, $supported)) |
|
170 | 170 | { |
171 | 171 | return; |
172 | 172 | } |
@@ -84,15 +84,15 @@ discard block |
||
84 | 84 | { |
85 | 85 | $literals = $this->requireParams()->getInfo()->getStringLiterals(); |
86 | 86 | |
87 | - if(empty($literals)) { |
|
87 | + if (empty($literals)) { |
|
88 | 88 | return; |
89 | 89 | } |
90 | 90 | |
91 | - foreach($literals as $literal) |
|
91 | + foreach ($literals as $literal) |
|
92 | 92 | { |
93 | 93 | $parts = ConvertHelper::explodeTrim(' ', $literal->getText()); |
94 | 94 | |
95 | - foreach($parts as $part) { |
|
95 | + foreach ($parts as $part) { |
|
96 | 96 | $this->addClass($part); |
97 | 97 | } |
98 | 98 | } |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | { |
107 | 107 | $className = trim($className); |
108 | 108 | |
109 | - if($this->isClassNameValid($className)) |
|
109 | + if ($this->isClassNameValid($className)) |
|
110 | 110 | { |
111 | - if(!in_array($className, $this->classes, true)) { |
|
111 | + if (!in_array($className, $this->classes, true)) { |
|
112 | 112 | $this->classes[] = $className; |
113 | 113 | } |
114 | 114 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | public function preProcessOpening(): string |
142 | 142 | { |
143 | - if($this->isMultiline()) { |
|
143 | + if ($this->isMultiline()) { |
|
144 | 144 | return sprintf('<pre%s>', $this->renderAttributes()); |
145 | 145 | } |
146 | 146 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | public function preProcessClosing(): string |
151 | 151 | { |
152 | - if($this->isMultiline()) { |
|
152 | + if ($this->isMultiline()) { |
|
153 | 153 | return '</pre>'; |
154 | 154 | } |
155 | 155 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | private function renderAttributes() : string |
160 | 160 | { |
161 | - if(empty($this->classes)) { |
|
161 | + if (empty($this->classes)) { |
|
162 | 162 | return ''; |
163 | 163 | } |
164 | 164 |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | public function getSourceVariable() : Mailcode_Variables_Variable |
103 | 103 | { |
104 | - if(isset($this->sourceVar)) |
|
104 | + if (isset($this->sourceVar)) |
|
105 | 105 | { |
106 | 106 | return $this->sourceVar->getVariable(); |
107 | 107 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | public function getLoopVariable() : Mailcode_Variables_Variable |
117 | 117 | { |
118 | - if(isset($this->loopVar)) |
|
118 | + if (isset($this->loopVar)) |
|
119 | 119 | { |
120 | 120 | return $this->loopVar->getVariable(); |
121 | 121 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $this->keyword = $info->getKeywordByIndex(1); |
136 | 136 | $this->sourceVar = $info->getVariableByIndex(2); |
137 | 137 | |
138 | - if(!$this->loopVar || !$this->keyword || !$this->sourceVar) |
|
138 | + if (!$this->loopVar || !$this->keyword || !$this->sourceVar) |
|
139 | 139 | { |
140 | 140 | $this->validationResult->makeError( |
141 | 141 | t('Not a valid for loop.').' '.t('Is the %1$s keyword missing?', 'in:'), |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | { |
151 | 151 | $keyword = $this->getInKeyword(); |
152 | 152 | |
153 | - if($keyword->isForIn()) |
|
153 | + if ($keyword->isForIn()) |
|
154 | 154 | { |
155 | 155 | return; |
156 | 156 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | protected function validateSyntax_variable_names() : void |
165 | 165 | { |
166 | - if($this->getSourceVariable()->getFullName() !== $this->getLoopVariable()->getFullName()) |
|
166 | + if ($this->getSourceVariable()->getFullName() !== $this->getLoopVariable()->getFullName()) |
|
167 | 167 | { |
168 | 168 | return; |
169 | 169 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | |
181 | 181 | $parts = explode('.', $name); |
182 | 182 | |
183 | - if(count($parts) === 1) { |
|
183 | + if (count($parts) === 1) { |
|
184 | 184 | return; |
185 | 185 | } |
186 | 186 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | |
198 | 198 | $parts = explode('.', $name); |
199 | 199 | |
200 | - if(count($parts) === 1) { |
|
200 | + if (count($parts) === 1) { |
|
201 | 201 | return; |
202 | 202 | } |
203 | 203 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | public function getInKeyword() : Mailcode_Parser_Statement_Tokenizer_Token_Keyword |
216 | 216 | { |
217 | - if(isset($this->keyword)) |
|
217 | + if (isset($this->keyword)) |
|
218 | 218 | { |
219 | 219 | return $this->keyword; |
220 | 220 | } |