@@ -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 |
@@ -73,7 +73,7 @@ |
||
73 | 73 | // All other special characters have to be escaped |
74 | 74 | // with two backslashes. |
75 | 75 | foreach ($this->regexSpecialChars as $char) { |
76 | - $string = str_replace($char, '\\' . $char, $string); |
|
76 | + $string = str_replace($char, '\\'.$char, $string); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | // Restore the escaped quotes, which stay escaped |
@@ -51,7 +51,7 @@ |
||
51 | 51 | $cmd = $this->commands->createCommand( |
52 | 52 | 'ShowDate', |
53 | 53 | '', |
54 | - $variableName . $format . $timezone, |
|
54 | + $variableName.$format.$timezone, |
|
55 | 55 | sprintf( |
56 | 56 | '{showdate: %s%s%s}', |
57 | 57 | $variableName, |
@@ -60,6 +60,6 @@ |
||
60 | 60 | return $string; |
61 | 61 | } |
62 | 62 | |
63 | - return '"' . str_replace('"', '\"', $string) . '"'; |
|
63 | + return '"'.str_replace('"', '\"', $string).'"'; |
|
64 | 64 | } |
65 | 65 | } |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | |
149 | 149 | if (!in_array($char, $this->allowedChars)) { |
150 | 150 | $result->makeError( |
151 | - t('Invalid character in date format:') . ' ' . |
|
152 | - t('%1$s at position %2$s.', '<code>' . $char . '</code>', $i + 1), |
|
151 | + t('Invalid character in date format:').' '. |
|
152 | + t('%1$s at position %2$s.', '<code>'.$char.'</code>', $i + 1), |
|
153 | 153 | self::VALIDATION_INVALID_FORMAT_CHARACTER |
154 | 154 | ); |
155 | 155 | |
@@ -194,12 +194,12 @@ discard block |
||
194 | 194 | $groups = array_keys($grouped); |
195 | 195 | |
196 | 196 | foreach ($groups as $group) { |
197 | - usort($grouped[$group], function (Mailcode_Date_FormatInfo_Character $a, Mailcode_Date_FormatInfo_Character $b) { |
|
197 | + usort($grouped[$group], function(Mailcode_Date_FormatInfo_Character $a, Mailcode_Date_FormatInfo_Character $b) { |
|
198 | 198 | return strnatcasecmp($a->getChar(), $b->getChar()); |
199 | 199 | }); |
200 | 200 | } |
201 | 201 | |
202 | - uksort($grouped, function (string $a, string $b) { |
|
202 | + uksort($grouped, function(string $a, string $b) { |
|
203 | 203 | return strnatcasecmp($a, $b); |
204 | 204 | }); |
205 | 205 |
@@ -20,13 +20,13 @@ |
||
20 | 20 | */ |
21 | 21 | class Mailcode_Collection_Error_Message extends Mailcode_Collection_Error |
22 | 22 | { |
23 | - public function __construct(string $matchedText, int $code, string $message, ?object $subject=null) |
|
23 | + public function __construct(string $matchedText, int $code, string $message, ?object $subject = null) |
|
24 | 24 | { |
25 | 25 | $this->matchedText = $matchedText; |
26 | 26 | $this->code = $code; |
27 | 27 | $this->message = $message; |
28 | 28 | |
29 | - if($subject instanceof Mailcode_Commands_Command) |
|
29 | + if ($subject instanceof Mailcode_Commands_Command) |
|
30 | 30 | { |
31 | 31 | $this->command = $subject; |
32 | 32 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | $value = $this->instantiator->quoteString($value); |
41 | 41 | } |
42 | 42 | |
43 | - $params = $variableName . ' = ' . $value; |
|
43 | + $params = $variableName.' = '.$value; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | $cmd = $this->commands->createCommand( |
@@ -30,7 +30,7 @@ |
||
30 | 30 | return $this->variables->createVariableByName($fullName); |
31 | 31 | } |
32 | 32 | |
33 | - public function pathName(string $path, ?string $name=null) : Mailcode_Variables_Variable |
|
33 | + public function pathName(string $path, ?string $name = null) : Mailcode_Variables_Variable |
|
34 | 34 | { |
35 | 35 | return $this->variables->createVariable($path, $name); |
36 | 36 | } |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | private ?Mailcode_Factory_CommandSets_Set_ElseIf $elseIf = null; |
28 | 28 | private ?Mailcode_Factory_CommandSets_Set_Variables $variables = null; |
29 | 29 | |
30 | - public function if() : Mailcode_Factory_CommandSets_Set_If |
|
30 | + public function if () : Mailcode_Factory_CommandSets_Set_If |
|
31 | 31 | { |
32 | - if(!isset($this->if)) |
|
32 | + if (!isset($this->if)) |
|
33 | 33 | { |
34 | 34 | $this->if = new Mailcode_Factory_CommandSets_Set_If(); |
35 | 35 | } |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | return $this->if; |
38 | 38 | } |
39 | 39 | |
40 | - public function elseIf() : Mailcode_Factory_CommandSets_Set_ElseIf |
|
40 | + public function elseIf () : Mailcode_Factory_CommandSets_Set_ElseIf |
|
41 | 41 | { |
42 | - if(!isset($this->elseIf)) |
|
42 | + if (!isset($this->elseIf)) |
|
43 | 43 | { |
44 | 44 | $this->elseIf = new Mailcode_Factory_CommandSets_Set_ElseIf(); |
45 | 45 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | public function show() : Mailcode_Factory_CommandSets_Set_Show |
51 | 51 | { |
52 | - if(!isset($this->show)) |
|
52 | + if (!isset($this->show)) |
|
53 | 53 | { |
54 | 54 | $this->show = new Mailcode_Factory_CommandSets_Set_Show(); |
55 | 55 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | public function misc() : Mailcode_Factory_CommandSets_Set_Misc |
61 | 61 | { |
62 | - if(!isset($this->misc)) |
|
62 | + if (!isset($this->misc)) |
|
63 | 63 | { |
64 | 64 | $this->misc = new Mailcode_Factory_CommandSets_Set_Misc(); |
65 | 65 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | public function set() : Mailcode_Factory_CommandSets_Set_Set |
71 | 71 | { |
72 | - if(!isset($this->set)) |
|
72 | + if (!isset($this->set)) |
|
73 | 73 | { |
74 | 74 | $this->set = new Mailcode_Factory_CommandSets_Set_Set(); |
75 | 75 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | public function var() : Mailcode_Factory_CommandSets_Set_Variables |
81 | 81 | { |
82 | - if(!isset($this->variables)) |
|
82 | + if (!isset($this->variables)) |
|
83 | 83 | { |
84 | 84 | $this->variables = new Mailcode_Factory_CommandSets_Set_Variables(); |
85 | 85 | } |