@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | protected function validateSyntax_params_parse() : void |
37 | 37 | { |
38 | - if(!$this->requiresParameters()) |
|
38 | + if (!$this->requiresParameters()) |
|
39 | 39 | { |
40 | 40 | return; |
41 | 41 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $this |
47 | 47 | ); |
48 | 48 | |
49 | - if(!$this->params->isValid()) |
|
49 | + if (!$this->params->isValid()) |
|
50 | 50 | { |
51 | 51 | $error = $this->params->getValidationResult(); |
52 | 52 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | private $sourceCommand; |
58 | 58 | |
59 | - public function __construct(string $statement, bool $freeform=false, ?Mailcode_Commands_Command $sourceCommand=null) |
|
59 | + public function __construct(string $statement, bool $freeform = false, ?Mailcode_Commands_Command $sourceCommand = null) |
|
60 | 60 | { |
61 | 61 | $this->sourceCommand = $sourceCommand; |
62 | 62 | $this->statement = $statement; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | public function getInfo() : Mailcode_Parser_Statement_Info |
93 | 93 | { |
94 | - if($this->info instanceof Mailcode_Parser_Statement_Info) |
|
94 | + if ($this->info instanceof Mailcode_Parser_Statement_Info) |
|
95 | 95 | { |
96 | 96 | return $this->info; |
97 | 97 | } |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | |
104 | 104 | protected function validate() : void |
105 | 105 | { |
106 | - if($this->freeform) |
|
106 | + if ($this->freeform) |
|
107 | 107 | { |
108 | 108 | return; |
109 | 109 | } |
110 | 110 | |
111 | - if(!$this->tokenizer->hasTokens()) |
|
111 | + if (!$this->tokenizer->hasTokens()) |
|
112 | 112 | { |
113 | 113 | $this->result->makeError( |
114 | 114 | t('Empty statement'), |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | $unknown = $this->tokenizer->getFirstUnknown(); |
122 | 122 | |
123 | - if($unknown) |
|
123 | + if ($unknown) |
|
124 | 124 | { |
125 | 125 | $this->result->makeError( |
126 | 126 | t('Unquoted string literal found:').' ('.htmlspecialchars($unknown->getMatchedText()).')', |
@@ -46,7 +46,7 @@ |
||
46 | 46 | * @param mixed $subject |
47 | 47 | * @param Mailcode_Commands_Command|null $sourceCommand |
48 | 48 | */ |
49 | - public function __construct(string $tokenID, string $matchedText, $subject=null, ?Mailcode_Commands_Command $sourceCommand=null) |
|
49 | + public function __construct(string $tokenID, string $matchedText, $subject = null, ?Mailcode_Commands_Command $sourceCommand = null) |
|
50 | 50 | { |
51 | 51 | $this->tokenID = $tokenID; |
52 | 52 | $this->matchedText = $matchedText; |
@@ -10,7 +10,7 @@ |
||
10 | 10 | { |
11 | 11 | $vars = Mailcode::create()->findVariables($this->tokenized, $this->tokenizer->getSourceCommand())->getGroupedByHash(); |
12 | 12 | |
13 | - foreach($vars as $var) |
|
13 | + foreach ($vars as $var) |
|
14 | 14 | { |
15 | 15 | $this->registerToken('Variable', $var->getMatchedText(), $var); |
16 | 16 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | $total = count($matches[0]); |
82 | 82 | |
83 | - for($i=0; $i < $total; $i++) |
|
83 | + for ($i = 0; $i < $total; $i++) |
|
84 | 84 | { |
85 | 85 | $match = $this->parseMatch($matches, $i); |
86 | 86 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | protected function prepareString(string $subject) : string |
96 | 96 | { |
97 | - if(!ConvertHelper::isStringHTML($subject)) |
|
97 | + if (!ConvertHelper::isStringHTML($subject)) |
|
98 | 98 | { |
99 | 99 | return $subject; |
100 | 100 | } |
@@ -145,17 +145,17 @@ discard block |
||
145 | 145 | private function handleNesting(Mailcode_Commands_Command $cmd) : void |
146 | 146 | { |
147 | 147 | // Set the command's parent from the stack, if any is present. |
148 | - if(!empty($this->stack)) |
|
148 | + if (!empty($this->stack)) |
|
149 | 149 | { |
150 | 150 | $cmd->setParent($this->getStackLast()); |
151 | 151 | } |
152 | 152 | |
153 | 153 | // Handle opening and closing commands, adding and removing from the stack. |
154 | - if($cmd instanceof Mailcode_Commands_Command_Type_Opening) |
|
154 | + if ($cmd instanceof Mailcode_Commands_Command_Type_Opening) |
|
155 | 155 | { |
156 | 156 | $this->stack[] = $cmd; |
157 | 157 | } |
158 | - else if($cmd instanceof Mailcode_Commands_Command_Type_Closing) |
|
158 | + else if ($cmd instanceof Mailcode_Commands_Command_Type_Closing) |
|
159 | 159 | { |
160 | 160 | array_pop($this->stack); |
161 | 161 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | { |
166 | 166 | $cmd = $this->stack[array_key_last($this->stack)]; |
167 | 167 | |
168 | - if($cmd instanceof Mailcode_Commands_Command) |
|
168 | + if ($cmd instanceof Mailcode_Commands_Command) |
|
169 | 169 | { |
170 | 170 | return $cmd; |
171 | 171 | } |
@@ -194,16 +194,16 @@ discard block |
||
194 | 194 | // 5 = parameter type command, type |
195 | 195 | // 6 = parameter type command, params |
196 | 196 | |
197 | - if(!empty($matches[1][$index])) |
|
197 | + if (!empty($matches[1][$index])) |
|
198 | 198 | { |
199 | 199 | $name = $matches[1][$index]; |
200 | 200 | } |
201 | - else if(!empty($matches[2][$index])) |
|
201 | + else if (!empty($matches[2][$index])) |
|
202 | 202 | { |
203 | 203 | $name = $matches[2][$index]; |
204 | 204 | $params = $matches[3][$index]; |
205 | 205 | } |
206 | - else if(!empty($matches[4][$index])) |
|
206 | + else if (!empty($matches[4][$index])) |
|
207 | 207 | { |
208 | 208 | $name = $matches[4][$index]; |
209 | 209 | $type = $matches[5][$index]; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | * @param Mailcode_Commands_Command|null $sourceCommand |
241 | 241 | * @return Mailcode_Parser_Statement |
242 | 242 | */ |
243 | - public function createStatement(string $statement, bool $freeform=false, ?Mailcode_Commands_Command $sourceCommand=null) : Mailcode_Parser_Statement |
|
243 | + public function createStatement(string $statement, bool $freeform = false, ?Mailcode_Commands_Command $sourceCommand = null) : Mailcode_Parser_Statement |
|
244 | 244 | { |
245 | 245 | return new Mailcode_Parser_Statement($statement, $freeform, $sourceCommand); |
246 | 246 | } |