@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | if (!$this->loopVar || !$this->keyword || !$this->sourceVar) { |
148 | 148 | $this->validationResult->makeError( |
149 | - t('Not a valid for loop.') . ' ' . t('Is the %1$s keyword missing?', 'in:'), |
|
149 | + t('Not a valid for loop.').' '.t('Is the %1$s keyword missing?', 'in:'), |
|
150 | 150 | self::VALIDATION_INVALID_FOR_STATEMENT |
151 | 151 | ); |
152 | 152 | |
@@ -191,8 +191,8 @@ discard block |
||
191 | 191 | } |
192 | 192 | |
193 | 193 | $this->validationResult->makeError( |
194 | - t('The source variable is not a list variable:') . ' ' . |
|
195 | - t('Expected a variable without dot, like %1$s.', '<code>$' . t('LIST') . '</code>'), |
|
194 | + t('The source variable is not a list variable:').' '. |
|
195 | + t('Expected a variable without dot, like %1$s.', '<code>$'.t('LIST').'</code>'), |
|
196 | 196 | self::VALIDATION_VARIABLE_NAME_WITH_DOT |
197 | 197 | ); |
198 | 198 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | // allowed ones. |
125 | 125 | if (!in_array($sign, $allowed)) { |
126 | 126 | $this->validationResult->makeError( |
127 | - t('The %1$s sign is not allowed in this command.', '<code>' . $sign . '</code>'), |
|
127 | + t('The %1$s sign is not allowed in this command.', '<code>'.$sign.'</code>'), |
|
128 | 128 | Mailcode_Commands_CommonConstants::VALIDATION_INVALID_OPERAND |
129 | 129 | ); |
130 | 130 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | throw new Mailcode_Exception( |
152 | 152 | 'No variable found.', |
153 | - 'Statement does not start with a variable: [' . $this->paramsString . ']', |
|
153 | + 'Statement does not start with a variable: ['.$this->paramsString.']', |
|
154 | 154 | Mailcode_Commands_CommonConstants::ERROR_NO_VARIABLE_AVAILABLE |
155 | 155 | ); |
156 | 156 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | { |
23 | 23 | public function __construct(string $message, ?string $details = null, $code = null, $previous = null) |
24 | 24 | { |
25 | - if(defined('TESTS_ROOT') && !empty($details)) { |
|
25 | + if (defined('TESTS_ROOT') && !empty($details)) { |
|
26 | 26 | $message .= PHP_EOL. |
27 | 27 | 'Details:'.PHP_EOL. |
28 | 28 | $details; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | $vars = Mailcode::create()->findVariables($this->tokenized, $this->tokenizer->getSourceCommand())->getGroupedByHash(); |
12 | 12 | |
13 | 13 | $names = array(); |
14 | - foreach($vars as $var) |
|
14 | + foreach ($vars as $var) |
|
15 | 15 | { |
16 | 16 | $names[$var->getMatchedText()] = $var; |
17 | 17 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | return strlen($b) - strlen($a); |
24 | 24 | }); |
25 | 25 | |
26 | - foreach($names as $name => $var) |
|
26 | + foreach ($names as $name => $var) |
|
27 | 27 | { |
28 | 28 | $this->registerToken('Variable', $name, $var); |
29 | 29 | } |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | { |
63 | 63 | $fullName = $this->fixName($fullName); |
64 | 64 | |
65 | - foreach($this->variables as $variable) |
|
65 | + foreach ($this->variables as $variable) |
|
66 | 66 | { |
67 | - if($variable->getFullName() === $fullName) |
|
67 | + if ($variable->getFullName() === $fullName) |
|
68 | 68 | { |
69 | 69 | return true; |
70 | 70 | } |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | |
88 | 88 | $collection = new Mailcode_Variables_Collection_Regular(); |
89 | 89 | |
90 | - foreach($this->variables as $variable) |
|
90 | + foreach ($this->variables as $variable) |
|
91 | 91 | { |
92 | - if($variable->getFullName() === $fullName) |
|
92 | + if ($variable->getFullName() === $fullName) |
|
93 | 93 | { |
94 | 94 | $collection->add($variable); |
95 | 95 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | { |
120 | 120 | $entries = array(); |
121 | 121 | |
122 | - foreach($this->variables as $variable) |
|
122 | + foreach ($this->variables as $variable) |
|
123 | 123 | { |
124 | 124 | $entries[$variable->getHash()] = $variable; |
125 | 125 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | { |
137 | 137 | $entries = array(); |
138 | 138 | |
139 | - foreach($this->variables as $variable) |
|
139 | + foreach ($this->variables as $variable) |
|
140 | 140 | { |
141 | 141 | $entries[$variable->getFullName()] = $variable; |
142 | 142 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | { |
156 | 156 | $entries = array(); |
157 | 157 | |
158 | - foreach($this->variables as $variable) |
|
158 | + foreach ($this->variables as $variable) |
|
159 | 159 | { |
160 | 160 | $entries[$variable->getUniqueName()] = $variable; |
161 | 161 | } |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | { |
181 | 181 | $result = array(); |
182 | 182 | |
183 | - foreach($this->variables as $variable) |
|
183 | + foreach ($this->variables as $variable) |
|
184 | 184 | { |
185 | 185 | $name = $variable->getFullName(); |
186 | 186 | |
187 | - if(!in_array($name, $result)) |
|
187 | + if (!in_array($name, $result)) |
|
188 | 188 | { |
189 | 189 | $result[] = $name; |
190 | 190 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | { |
224 | 224 | $variables = $collection->getGroupedByHash(); |
225 | 225 | |
226 | - foreach($variables as $variable) |
|
226 | + foreach ($variables as $variable) |
|
227 | 227 | { |
228 | 228 | $this->add($variable); |
229 | 229 | } |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | { |
236 | 236 | $variables = $this->getAll(); |
237 | 237 | |
238 | - if(!empty($variables)) |
|
238 | + if (!empty($variables)) |
|
239 | 239 | { |
240 | 240 | return array_shift($variables); |
241 | 241 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | { |
30 | 30 | $varName = undollarize($command->getVariableName()); |
31 | 31 | |
32 | - if($command->isHTMLEnabled()) |
|
32 | + if ($command->isHTMLEnabled()) |
|
33 | 33 | { |
34 | 34 | $statement = sprintf( |
35 | 35 | '%s.replaceAll($esc.newline, "<br/>")', |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | // Split the variable name by the dot |
45 | 45 | $parts = explode('.', undollarize($var->getFullName())); |
46 | 46 | |
47 | - if(count($parts) !== 2) |
|
47 | + if (count($parts) !== 2) |
|
48 | 48 | { |
49 | 49 | $this->validationResult->makeError( |
50 | 50 | t('The variable %1$s is not a list property:', '<code>'.$var->getFullName().'</code>').' '. |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function getListVariable() : Mailcode_Variables_Variable |
78 | 78 | { |
79 | - if(isset($this->listVariable)) |
|
79 | + if (isset($this->listVariable)) |
|
80 | 80 | { |
81 | 81 | return $this->listVariable; |
82 | 82 | } |
@@ -59,12 +59,12 @@ |
||
59 | 59 | * @throws Mailcode_Exception |
60 | 60 | * @throws Mailcode_Factory_Exception |
61 | 61 | */ |
62 | - public function for(string $sourceVariable, string $loopVariable, $breakAtValue = ''): Mailcode_Commands_Command_For |
|
62 | + public function for (string $sourceVariable, string $loopVariable, $breakAtValue = ''): Mailcode_Commands_Command_For |
|
63 | 63 | { |
64 | 64 | $sourceVariable = dollarize($sourceVariable); |
65 | 65 | $loopVariable = dollarize($loopVariable); |
66 | 66 | |
67 | - if($breakAtValue instanceof Mailcode_Variables_Variable) { |
|
67 | + if ($breakAtValue instanceof Mailcode_Variables_Variable) { |
|
68 | 68 | $breakAtValue = $breakAtValue->getFullName(); |
69 | 69 | } |
70 | 70 |
@@ -34,21 +34,21 @@ discard block |
||
34 | 34 | * @param Mailcode_Commands_Command|null $sourceCommand |
35 | 35 | * @return Mailcode_Variables_Collection_Regular |
36 | 36 | */ |
37 | - public function parseString(string $subject, ?Mailcode_Commands_Command $sourceCommand=null) : Mailcode_Variables_Collection_Regular |
|
37 | + public function parseString(string $subject, ?Mailcode_Commands_Command $sourceCommand = null) : Mailcode_Variables_Collection_Regular |
|
38 | 38 | { |
39 | 39 | $this->collection = new Mailcode_Variables_Collection_Regular(); |
40 | 40 | |
41 | 41 | $matches = array(); |
42 | 42 | preg_match_all(self::REGEX_VARIABLE_NAME, $subject, $matches, PREG_PATTERN_ORDER); |
43 | 43 | |
44 | - if(empty($matches[0])) |
|
44 | + if (empty($matches[0])) |
|
45 | 45 | { |
46 | 46 | return $this->collection; |
47 | 47 | } |
48 | 48 | |
49 | - foreach($matches[0] as $idx => $matchedText) |
|
49 | + foreach ($matches[0] as $idx => $matchedText) |
|
50 | 50 | { |
51 | - if(!empty($matches[3][$idx])) |
|
51 | + if (!empty($matches[3][$idx])) |
|
52 | 52 | { |
53 | 53 | $this->addSingle($matches[3][$idx], $matchedText, $sourceCommand); |
54 | 54 | } |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | return $this->collection; |
62 | 62 | } |
63 | 63 | |
64 | - protected function addSingle(string $name, string $matchedText, ?Mailcode_Commands_Command $sourceCommand=null) : void |
|
64 | + protected function addSingle(string $name, string $matchedText, ?Mailcode_Commands_Command $sourceCommand = null) : void |
|
65 | 65 | { |
66 | 66 | // ignore US style numbers like $451 |
67 | - if(is_numeric($name)) |
|
67 | + if (is_numeric($name)) |
|
68 | 68 | { |
69 | 69 | return; |
70 | 70 | } |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | $this->collection->add(new Mailcode_Variables_Variable('', $name, $matchedText, $sourceCommand)); |
73 | 73 | } |
74 | 74 | |
75 | - protected function addPathed(string $path, string $name, string $matchedText, ?Mailcode_Commands_Command $sourceCommand=null) : void |
|
75 | + protected function addPathed(string $path, string $name, string $matchedText, ?Mailcode_Commands_Command $sourceCommand = null) : void |
|
76 | 76 | { |
77 | 77 | // ignore US style numbers like $45.12 |
78 | - if(is_numeric($path.'.'.$name)) |
|
78 | + if (is_numeric($path.'.'.$name)) |
|
79 | 79 | { |
80 | 80 | return; |
81 | 81 | } |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | return ltrim($name, '$'); |
94 | 94 | } |
95 | 95 | |
96 | - public function createVariable(string $path, ?string $name='') : Mailcode_Variables_Variable |
|
96 | + public function createVariable(string $path, ?string $name = '') : Mailcode_Variables_Variable |
|
97 | 97 | { |
98 | - if(empty($name)) { |
|
98 | + if (empty($name)) { |
|
99 | 99 | $fullName = dollarize($path); |
100 | 100 | $name = $path; |
101 | 101 | $path = ''; |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | { |
111 | 111 | $parts = explode('.', undollarize($name)); |
112 | 112 | |
113 | - if(count($parts) === 1) { |
|
113 | + if (count($parts) === 1) { |
|
114 | 114 | return $this->createVariable($parts[0]); |
115 | 115 | } |
116 | 116 |