@@ -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 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | public function normalize() : string |
39 | 39 | { |
40 | - if(!$this->command->isValid()) |
|
40 | + if (!$this->command->isValid()) |
|
41 | 41 | { |
42 | 42 | return ''; |
43 | 43 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | private function addType() : void |
59 | 59 | { |
60 | - if(!$this->command->supportsType() || !$this->command->hasType()) |
|
60 | + if (!$this->command->supportsType() || !$this->command->hasType()) |
|
61 | 61 | { |
62 | 62 | return; |
63 | 63 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | private function addParams(Mailcode_Commands_Command $command) : void |
69 | 69 | { |
70 | - if($command->hasFreeformParameters()) |
|
70 | + if ($command->hasFreeformParameters()) |
|
71 | 71 | { |
72 | 72 | $params = $command->getParams()->getStatementString(); |
73 | 73 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $params = $command->getParams()->getNormalized(); |
77 | 77 | } |
78 | 78 | |
79 | - if(empty($params)) |
|
79 | + if (empty($params)) |
|
80 | 80 | { |
81 | 81 | return; |
82 | 82 | } |
@@ -87,14 +87,14 @@ discard block |
||
87 | 87 | |
88 | 88 | private function addLogicKeywords() : void |
89 | 89 | { |
90 | - if(!$this->command->supportsLogicKeywords()) |
|
90 | + if (!$this->command->supportsLogicKeywords()) |
|
91 | 91 | { |
92 | 92 | return; |
93 | 93 | } |
94 | 94 | |
95 | 95 | $keywords = $this->command->getLogicKeywords()->getKeywords(); |
96 | 96 | |
97 | - foreach($keywords as $keyword) |
|
97 | + foreach ($keywords as $keyword) |
|
98 | 98 | { |
99 | 99 | $this->parts[] = ' '; |
100 | 100 | $this->parts[] = $keyword->getKeywordString(); // e.g. "if variable" |