@@ -14,5 +14,5 @@ |
||
14 | 14 | |
15 | 15 | public function getTryTimes(): int; |
16 | 16 | |
17 | - public function getErrors(): array ; |
|
17 | + public function getErrors(): array; |
|
18 | 18 | } |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! function_exists('toUnderScore')) { |
|
3 | +if (!function_exists('toUnderScore')) { |
|
4 | 4 | function toUnderScore($str) |
5 | 5 | { |
6 | - $result = preg_replace_callback('/([A-Z]+)/', function ($matches) { |
|
6 | + $result = preg_replace_callback('/([A-Z]+)/', function($matches) { |
|
7 | 7 | return '_' . strtolower($matches[0]); |
8 | 8 | }, $str); |
9 | 9 |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | public function register() |
10 | 10 | { |
11 | - $this->app->singleton(IpClient::class, function () { |
|
11 | + $this->app->singleton(IpClient::class, function() { |
|
12 | 12 | return new IpClient; |
13 | 13 | }); |
14 | 14 |
@@ -89,7 +89,7 @@ |
||
89 | 89 | */ |
90 | 90 | public function hasInfo(): bool |
91 | 91 | { |
92 | - return ! is_null($this->info); |
|
92 | + return !is_null($this->info); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | { |
83 | 83 | $b = preg_match("/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/", $ip); |
84 | 84 | |
85 | - if (! $b) { |
|
85 | + if (!$b) { |
|
86 | 86 | throw new InvalidIpAddress; |
87 | 87 | } |
88 | 88 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $providerInstance = []; |
98 | 98 | |
99 | 99 | foreach ($this->getProviders() as $provider) { |
100 | - if (! isset($this->instances[$provider])) { |
|
100 | + if (!isset($this->instances[$provider])) { |
|
101 | 101 | $this->instances[$provider] = $this->createProvider($provider); |
102 | 102 | } |
103 | 103 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | $class = __NAMESPACE__ . "\Strategies\\{$shortName}"; |
125 | 125 | |
126 | - if (! class_exists($class)) { |
|
126 | + if (!class_exists($class)) { |
|
127 | 127 | throw new IpProviderClassNotExistException("{$class} 不存在"); |
128 | 128 | } |
129 | 129 | |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | { |
155 | 155 | $response = $this->getOriginalInfo(); |
156 | 156 | |
157 | - if (! $response['success']) { |
|
157 | + if (!$response['success']) { |
|
158 | 158 | return (new NullDataMapper())->setInfo(['ip' => $this->getIp()]); |
159 | 159 | } |
160 | 160 | |
161 | - if (! $this->dataMapper) { |
|
161 | + if (!$this->dataMapper) { |
|
162 | 162 | $this->dataMapper = new DataMapper(); |
163 | 163 | |
164 | 164 | return $this->dataMapper->setInfo($response); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function getRequestHandler() |
176 | 176 | { |
177 | - if (! $this->requestHandler) { |
|
177 | + if (!$this->requestHandler) { |
|
178 | 178 | return $this->requestHandler = new RequestHandler(); |
179 | 179 | } |
180 | 180 | |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | */ |
251 | 251 | public function getIp() |
252 | 252 | { |
253 | - if (! $this->ip) { |
|
253 | + if (!$this->ip) { |
|
254 | 254 | throw new \Exception('请先设置 ip'); |
255 | 255 | } |
256 | 256 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | */ |
280 | 280 | public function getProviderConfig(string $provider) |
281 | 281 | { |
282 | - if (! isset($this->providerConfig[$provider])) { |
|
282 | + if (!isset($this->providerConfig[$provider])) { |
|
283 | 283 | return []; |
284 | 284 | } |
285 | 285 |