@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | $this->instantiator->checkCommand($cmd); |
35 | 35 | |
36 | - if($cmd instanceof Mailcode_Commands_Command_ShowVariable) |
|
36 | + if ($cmd instanceof Mailcode_Commands_Command_ShowVariable) |
|
37 | 37 | { |
38 | 38 | return $cmd; |
39 | 39 | } |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | throw $this->instantiator->exceptionUnexpectedType('ShowVariable', $cmd); |
42 | 42 | } |
43 | 43 | |
44 | - public function date(string $variableName, string $formatString="") : Mailcode_Commands_Command_ShowDate |
|
44 | + public function date(string $variableName, string $formatString = "") : Mailcode_Commands_Command_ShowDate |
|
45 | 45 | { |
46 | 46 | $variableName = $this->instantiator->filterVariableName($variableName); |
47 | 47 | |
48 | 48 | $format = ''; |
49 | - if(!empty($formatString)) |
|
49 | + if (!empty($formatString)) |
|
50 | 50 | { |
51 | 51 | $format = sprintf( |
52 | 52 | ' "%s"', |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | $this->instantiator->checkCommand($cmd); |
69 | 69 | |
70 | - if($cmd instanceof Mailcode_Commands_Command_ShowDate) |
|
70 | + if ($cmd instanceof Mailcode_Commands_Command_ShowDate) |
|
71 | 71 | { |
72 | 72 | return $cmd; |
73 | 73 | } |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | throw $this->instantiator->exceptionUnexpectedType('ShowDate', $cmd); |
76 | 76 | } |
77 | 77 | |
78 | - public function number(string $variableName, string $formatString="") : Mailcode_Commands_Command_ShowNumber |
|
78 | + public function number(string $variableName, string $formatString = "") : Mailcode_Commands_Command_ShowNumber |
|
79 | 79 | { |
80 | 80 | $variableName = $this->instantiator->filterVariableName($variableName); |
81 | 81 | |
82 | 82 | $format = ''; |
83 | - if(!empty($formatString)) |
|
83 | + if (!empty($formatString)) |
|
84 | 84 | { |
85 | 85 | $format = sprintf( |
86 | 86 | ' "%s"', |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | $this->instantiator->checkCommand($cmd); |
103 | 103 | |
104 | - if($cmd instanceof Mailcode_Commands_Command_ShowNumber) |
|
104 | + if ($cmd instanceof Mailcode_Commands_Command_ShowNumber) |
|
105 | 105 | { |
106 | 106 | return $cmd; |
107 | 107 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @throws Mailcode_Exception |
120 | 120 | * @throws Mailcode_Factory_Exception |
121 | 121 | */ |
122 | - public function phone(string $variableName, string $sourceFormat, string $urlEncoding=Mailcode_Factory::URL_ENCODING_NONE) : Mailcode_Commands_Command_ShowPhone |
|
122 | + public function phone(string $variableName, string $sourceFormat, string $urlEncoding = Mailcode_Factory::URL_ENCODING_NONE) : Mailcode_Commands_Command_ShowPhone |
|
123 | 123 | { |
124 | 124 | $variableName = $this->instantiator->filterVariableName($variableName); |
125 | 125 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $this->instantiator->checkCommand($cmd); |
143 | 143 | $this->instantiator->setEncoding($cmd, $urlEncoding); |
144 | 144 | |
145 | - if($cmd instanceof Mailcode_Commands_Command_ShowPhone) |
|
145 | + if ($cmd instanceof Mailcode_Commands_Command_ShowPhone) |
|
146 | 146 | { |
147 | 147 | return $cmd; |
148 | 148 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | $this->instantiator->checkCommand($cmd); |
165 | 165 | |
166 | - if($cmd instanceof Mailcode_Commands_Command_ShowSnippet) |
|
166 | + if ($cmd instanceof Mailcode_Commands_Command_ShowSnippet) |
|
167 | 167 | { |
168 | 168 | return $cmd; |
169 | 169 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | // All other special characters have to be escaped |
71 | 71 | // with two backslashes. |
72 | - foreach($this->regexSpecialChars as $char) |
|
72 | + foreach ($this->regexSpecialChars as $char) |
|
73 | 73 | { |
74 | 74 | $string = str_replace($char, '\\'.$char, $string); |
75 | 75 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | protected function addURLEncoding(Mailcode_Commands_Command $command, string $statement) : string |
85 | 85 | { |
86 | - if($command->isURLEncoded()) |
|
86 | + if ($command->isURLEncoded()) |
|
87 | 87 | { |
88 | 88 | return sprintf( |
89 | 89 | '${esc.url($%s)}', |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | ); |
92 | 92 | } |
93 | 93 | |
94 | - if($command->isURLDecoded()) |
|
94 | + if ($command->isURLDecoded()) |
|
95 | 95 | { |
96 | 96 | return sprintf( |
97 | 97 | '${esc.unurl($%s)}', |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $varName = ltrim($command->getVariableName(), '$'); |
57 | 57 | $javaFormat = $this->translateFormat($command->getFormatString()); |
58 | 58 | |
59 | - if(empty($internalFormat)) |
|
59 | + if (empty($internalFormat)) |
|
60 | 60 | { |
61 | 61 | $internalFormat = self::DEFAULT_INTERNAL_FORMAT; |
62 | 62 | } |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | $chars = ConvertHelper::string2array($formatString); |
77 | 77 | $result = array(); |
78 | 78 | |
79 | - foreach($chars as $char) |
|
79 | + foreach ($chars as $char) |
|
80 | 80 | { |
81 | - if(!isset($this->charTable[$char])) |
|
81 | + if (!isset($this->charTable[$char])) |
|
82 | 82 | { |
83 | 83 | throw new Mailcode_Translator_Exception( |
84 | 84 | 'Unknown date format string character', |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | { |
241 | 241 | $val = $this->validator->createStringLiteral(); |
242 | 242 | |
243 | - if($val->isValid()) |
|
243 | + if ($val->isValid()) |
|
244 | 244 | { |
245 | 245 | $this->sourceFormat = strtoupper($val->getToken()->getText()); |
246 | 246 | return; |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | */ |
259 | 259 | protected function validateSyntax_country_code(): void |
260 | 260 | { |
261 | - if(isset(self::$supportedCountries[$this->sourceFormat])) { |
|
261 | + if (isset(self::$supportedCountries[$this->sourceFormat])) { |
|
262 | 262 | return; |
263 | 263 | } |
264 | 264 |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | declare(strict_types=1); |
4 | 4 | |
5 | -if(!file_exists('../vendor/autoload.php')) { |
|
5 | +if (!file_exists('../vendor/autoload.php')) { |
|
6 | 6 | die('Autoloader not present.'); |
7 | 7 | } |
8 | 8 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $error = null; |
31 | 31 | $activeSyntax = $syntaxes[0]->getTypeID(); |
32 | 32 | |
33 | -if($request->getBool('translate')) |
|
33 | +if ($request->getBool('translate')) |
|
34 | 34 | { |
35 | 35 | $commandsText = $request->getParam('mailcode'); |
36 | 36 | $activeSyntax = (string)$request->registerParam('syntax') |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | $error = $e->getMessage(); |
48 | 48 | |
49 | 49 | $collection = $e->getCollection(); |
50 | - if($collection) |
|
50 | + if ($collection) |
|
51 | 51 | { |
52 | 52 | $first = $collection->getFirstError(); |
53 | 53 | $error = $first->getMessage(); |
54 | 54 | $matched = $first->getMatchedText(); |
55 | - if(!empty($matched)) { |
|
55 | + if (!empty($matched)) { |
|
56 | 56 | $error .= '<br>'.t('In command:').' <code>'.$matched.'</code>'; |
57 | 57 | } |
58 | 58 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $selected = ''; |
120 | 120 | $typeID = $syntax->getTypeID(); |
121 | 121 | |
122 | - if($typeID === $activeSyntax) { |
|
122 | + if ($typeID === $activeSyntax) { |
|
123 | 123 | $selected = ' selected'; |
124 | 124 | } |
125 | 125 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | <p></p><br> |
140 | 140 | <h2><?php pt('Translated commands') ?></h2> |
141 | 141 | <?php |
142 | - if(empty($commandsText)) |
|
142 | + if (empty($commandsText)) |
|
143 | 143 | { |
144 | 144 | ?> |
145 | 145 | <div class="alert alert-info"> |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | </div> |
148 | 148 | <?php |
149 | 149 | } |
150 | - else if($error) |
|
150 | + else if ($error) |
|
151 | 151 | { |
152 | 152 | ?> |
153 | 153 | <div class="alert alert-danger"> |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $cacheFile = 'libphone.xml'; |
21 | 21 | $cacheExpiry = 60 * 60; // 1 hour |
22 | 22 | |
23 | -if(!file_exists($cacheFile) || (filemtime($cacheFile) + $cacheExpiry) < time()) |
|
23 | +if (!file_exists($cacheFile) || (filemtime($cacheFile) + $cacheExpiry) < time()) |
|
24 | 24 | { |
25 | 25 | try |
26 | 26 | { |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | preg_match_all('/<!-- (\w+) \(([A-Z]+)\) -->/si', $xml, $result, PREG_PATTERN_ORDER); |
41 | 41 | |
42 | 42 | $lines = array(); |
43 | -foreach($result[1] as $idx => $country) |
|
43 | +foreach ($result[1] as $idx => $country) |
|
44 | 44 | { |
45 | 45 | $lines[] = sprintf( |
46 | 46 | " '%s' => '%s'", |