@@ -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"> |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | static $ids = array(); |
| 48 | 48 | |
| 49 | - if(empty($ids)) { |
|
| 49 | + if (empty($ids)) { |
|
| 50 | 50 | $ids = FileHelper::createFileFinder(__DIR__.'/Commands/Command') |
| 51 | 51 | ->getPHPClassNames(); |
| 52 | 52 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function getAll() |
| 66 | 66 | { |
| 67 | - if(!empty($this->commands)) { |
|
| 67 | + if (!empty($this->commands)) { |
|
| 68 | 68 | return $this->commands; |
| 69 | 69 | } |
| 70 | 70 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | $result = array(); |
| 74 | 74 | |
| 75 | - foreach($ids as $id) |
|
| 75 | + foreach ($ids as $id) |
|
| 76 | 76 | { |
| 77 | 77 | $result[] = $this->getDummyCommand($id); |
| 78 | 78 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | { |
| 98 | 98 | static $instances = array(); |
| 99 | 99 | |
| 100 | - if(!isset($instances[$id])) |
|
| 100 | + if (!isset($instances[$id])) |
|
| 101 | 101 | { |
| 102 | 102 | $instances[$id] = $this->createCommand($id, '__dummy', '', ''); |
| 103 | 103 | } |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | { |
| 119 | 119 | $items = $this->getAll(); |
| 120 | 120 | |
| 121 | - foreach($items as $item) |
|
| 121 | + foreach ($items as $item) |
|
| 122 | 122 | { |
| 123 | - if($item->getName() === $name) { |
|
| 123 | + if ($item->getName() === $name) { |
|
| 124 | 124 | return $item->getID(); |
| 125 | 125 | } |
| 126 | 126 | } |
@@ -152,9 +152,9 @@ discard block |
||
| 152 | 152 | { |
| 153 | 153 | $items = $this->getAll(); |
| 154 | 154 | |
| 155 | - foreach($items as $item) |
|
| 155 | + foreach ($items as $item) |
|
| 156 | 156 | { |
| 157 | - if($item->getName() === $name) { |
|
| 157 | + if ($item->getName() === $name) { |
|
| 158 | 158 | return true; |
| 159 | 159 | } |
| 160 | 160 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | { |
| 167 | 167 | $class = $this->resolveClassName($id, $type); |
| 168 | 168 | |
| 169 | - if(!class_exists($class)) |
|
| 169 | + if (!class_exists($class)) |
|
| 170 | 170 | { |
| 171 | 171 | throw new Mailcode_Exception( |
| 172 | 172 | 'No such command', |
@@ -188,9 +188,9 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | $dummy = $this->getDummyCommand($id); |
| 190 | 190 | |
| 191 | - if($dummy->supportsType()) |
|
| 191 | + if ($dummy->supportsType()) |
|
| 192 | 192 | { |
| 193 | - if(empty($type)) |
|
| 193 | + if (empty($type)) |
|
| 194 | 194 | { |
| 195 | 195 | $type = $dummy->getDefaultType(); |
| 196 | 196 | } |
@@ -228,14 +228,14 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | private function getDummyCommand(string $id) : Mailcode_Commands_Command |
| 230 | 230 | { |
| 231 | - if(isset(self::$dummyCommands[$id])) { |
|
| 231 | + if (isset(self::$dummyCommands[$id])) { |
|
| 232 | 232 | return self::$dummyCommands[$id]; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | $class = 'Mailcode\Mailcode_Commands_Command_'.$id; |
| 236 | 236 | $cmd = new $class('__dummy'); |
| 237 | 237 | |
| 238 | - if($cmd instanceof Mailcode_Commands_Command) |
|
| 238 | + if ($cmd instanceof Mailcode_Commands_Command) |
|
| 239 | 239 | { |
| 240 | 240 | self::$dummyCommands[$id] = $cmd; |
| 241 | 241 | return $cmd; |
@@ -79,7 +79,7 @@ |
||
| 79 | 79 | { |
| 80 | 80 | $meta = $phoneNumberUtil->getMetadataForRegion($code); |
| 81 | 81 | if (!$meta) { |
| 82 | - die('No metadata for ' . $code); |
|
| 82 | + die('No metadata for '.$code); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $exampleNumber = $phoneNumberUtil->getExampleNumber($code); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | { |
| 72 | 72 | $val = $this->validator->createStringLiteral(); |
| 73 | 73 | |
| 74 | - if($val->isValid()) |
|
| 74 | + if ($val->isValid()) |
|
| 75 | 75 | { |
| 76 | 76 | $this->sourceFormat = strtoupper($val->getToken()->getText()); |
| 77 | 77 | return; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | { |
| 94 | 94 | $countries = self::getSupportedCountries(); |
| 95 | 95 | |
| 96 | - if(isset($countries[$this->sourceFormat])) { |
|
| 96 | + if (isset($countries[$this->sourceFormat])) { |
|
| 97 | 97 | return; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | public static function getSupportedCountries() : array |
| 114 | 114 | { |
| 115 | - if(self::$countriesLoaded) { |
|
| 115 | + if (self::$countriesLoaded) { |
|
| 116 | 116 | return self::$supportedCountries; |
| 117 | 117 | } |
| 118 | 118 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | $data = FileHelper::parseJSONFile(__DIR__.'/ShowPhone/numbers.json'); |
| 122 | 122 | |
| 123 | - foreach($data as $code => $def) |
|
| 123 | + foreach ($data as $code => $def) |
|
| 124 | 124 | { |
| 125 | 125 | $code = strval($code); |
| 126 | 126 | |