@@ -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 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | public function resolveProviders() |
96 | 96 | { |
97 | 97 | foreach ($this->getProviders() as $provider) { |
98 | - if (! isset($this->instances[$provider])) { |
|
98 | + if (!isset($this->instances[$provider])) { |
|
99 | 99 | $this->instances[$provider] = $this->createProvider($provider); |
100 | 100 | } |
101 | 101 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | $class = __NAMESPACE__ . "\Strategies\\{$shortName}"; |
122 | 122 | |
123 | - if (! class_exists($class)) { |
|
123 | + if (!class_exists($class)) { |
|
124 | 124 | throw new IpProviderClassNotExistException("{$class} 不存在"); |
125 | 125 | } |
126 | 126 | |
@@ -151,11 +151,11 @@ discard block |
||
151 | 151 | { |
152 | 152 | $response = $this->getOriginalInfo(); |
153 | 153 | |
154 | - if (! $response['success']) { |
|
154 | + if (!$response['success']) { |
|
155 | 155 | return (new NullDataMapper())->setInfo(['ip' => $this->getIp()]); |
156 | 156 | } |
157 | 157 | |
158 | - if (! $this->dataMapper) { |
|
158 | + if (!$this->dataMapper) { |
|
159 | 159 | $this->dataMapper = new DataMapper(); |
160 | 160 | |
161 | 161 | return $this->dataMapper->setInfo($response); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function getRequestHandler() |
173 | 173 | { |
174 | - if (! $this->requestHandler) { |
|
174 | + if (!$this->requestHandler) { |
|
175 | 175 | return $this->requestHandler = new RequestHandler(); |
176 | 176 | } |
177 | 177 | |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | */ |
250 | 250 | public function getIp() |
251 | 251 | { |
252 | - if (! $this->ip) { |
|
252 | + if (!$this->ip) { |
|
253 | 253 | throw new \Exception('请先设置 ip'); |
254 | 254 | } |
255 | 255 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public function getProviderConfig(string $provider): array |
278 | 278 | { |
279 | - if (! isset($this->providerConfig[$provider])) { |
|
279 | + if (!isset($this->providerConfig[$provider])) { |
|
280 | 280 | return []; |
281 | 281 | } |
282 | 282 |