@@ -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(['ip' => $this->getIp()]); |
157 | 157 | } |
158 | 158 | |
159 | - if (! $this->dataMapper) { |
|
159 | + if (!$this->dataMapper) { |
|
160 | 160 | return $this->dataMapper = new DataMapper($response); |
161 | 161 | } |
162 | 162 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function getRequestHandler() |
172 | 172 | { |
173 | - if (! $this->requestHandler) { |
|
173 | + if (!$this->requestHandler) { |
|
174 | 174 | return $this->requestHandler = new RequestHandler(); |
175 | 175 | } |
176 | 176 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | */ |
265 | 265 | public function getProviderConfig(string $provider): array |
266 | 266 | { |
267 | - if (! isset($this->providerConfig[$provider])) { |
|
267 | + if (!isset($this->providerConfig[$provider])) { |
|
268 | 268 | return []; |
269 | 269 | } |
270 | 270 |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function hasInfo(): bool |
77 | 77 | { |
78 | - return ! is_null($this->info); |
|
78 | + return !is_null($this->info); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | return isset($this->info[$field]) ? $this->info[$field] : ''; |
122 | 122 | } |
123 | 123 | |
124 | - if (! method_exists($this, $name)) { |
|
124 | + if (!method_exists($this, $name)) { |
|
125 | 125 | throw new MethodNotExistException("{$name} 方法不存在"); |
126 | 126 | } |
127 | 127 | } |
@@ -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 | } |