@@ -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 | |
@@ -111,7 +111,7 @@ |
||
| 111 | 111 | return isset($this->info[$field]) ? $this->info[$field] : null; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if (! method_exists($this, $name)) { |
|
| 114 | + if (!method_exists($this, $name)) { |
|
| 115 | 115 | throw new MethodNotExistException("{$name} 方法不存在"); |
| 116 | 116 | } |
| 117 | 117 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | { |
| 84 | 84 | $b = preg_match("/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/", $ip); |
| 85 | 85 | |
| 86 | - if (! $b) { |
|
| 86 | + if (!$b) { |
|
| 87 | 87 | throw new InvalidIpAddress; |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | public function resolveProviders() |
| 97 | 97 | { |
| 98 | 98 | foreach ($this->getProviders() as $provider) { |
| 99 | - if (! isset($this->instances[$provider])) { |
|
| 99 | + if (!isset($this->instances[$provider])) { |
|
| 100 | 100 | $this->instances[$provider] = $this->createProvider($provider); |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | $class = __NAMESPACE__ . "\Strategies\\{$shortName}"; |
| 123 | 123 | |
| 124 | - if (! class_exists($class)) { |
|
| 124 | + if (!class_exists($class)) { |
|
| 125 | 125 | throw new IpProviderClassNotExistException("{$class} 不存在"); |
| 126 | 126 | } |
| 127 | 127 | |
@@ -152,11 +152,11 @@ discard block |
||
| 152 | 152 | { |
| 153 | 153 | $response = $this->getOriginalInfo(); |
| 154 | 154 | |
| 155 | - if (! $response['success']) { |
|
| 155 | + if (!$response['success']) { |
|
| 156 | 156 | return (new NullDataMapper())->setInfo(['ip' => $this->getIp()]); |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - if (! $this->dataMapper) { |
|
| 159 | + if (!$this->dataMapper) { |
|
| 160 | 160 | $this->dataMapper = new DataMapper(); |
| 161 | 161 | |
| 162 | 162 | return $this->dataMapper->setInfo($response); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | public function getRequestHandler() |
| 174 | 174 | { |
| 175 | - if (! $this->requestHandler) { |
|
| 175 | + if (!$this->requestHandler) { |
|
| 176 | 176 | return $this->requestHandler = new RequestHandler(); |
| 177 | 177 | } |
| 178 | 178 | |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | */ |
| 274 | 274 | public function getProviderConfig(string $provider): array |
| 275 | 275 | { |
| 276 | - if (! isset($this->providerConfig[$provider])) { |
|
| 276 | + if (!isset($this->providerConfig[$provider])) { |
|
| 277 | 277 | return []; |
| 278 | 278 | } |
| 279 | 279 | |
@@ -89,7 +89,7 @@ discard block |
||
| 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 | /** |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | return $this->getField($field); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - if (! method_exists($this, $name)) { |
|
| 128 | + if (!method_exists($this, $name)) { |
|
| 129 | 129 | throw new MethodNotExistException("{$name} 方法不存在"); |
| 130 | 130 | } |
| 131 | 131 | } |