@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | */ |
15 | 15 | public function boot() |
16 | 16 | { |
17 | - $this->app['view']->share('client', $this->app['client']); |
|
17 | + $this->app[ 'view' ]->share('client', $this->app[ 'client' ]); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | /** |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | */ |
37 | 37 | protected function registerAgent() |
38 | 38 | { |
39 | - if (! $this->app->bound('agent')) { |
|
40 | - $this->app->singleton('agent', function () { |
|
39 | + if (!$this->app->bound('agent')) { |
|
40 | + $this->app->singleton('agent', function() { |
|
41 | 41 | return new Agent; |
42 | 42 | }); |
43 | 43 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | protected function registerClient() |
54 | 54 | { |
55 | - $this->app->singleton('client', function ($app) { |
|
55 | + $this->app->singleton('client', function($app) { |
|
56 | 56 | return (new Client)->setAgent($app->make('agent')); |
57 | 57 | }); |
58 | 58 |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | { |
80 | 80 | $version = $this->agent->version($propertyName, $type); |
81 | 81 | |
82 | - return is_string($version) ? str_replace(['_', '+'], '.', $version) : $version; |
|
82 | + return is_string($version) ? str_replace([ '_', '+' ], '.', $version) : $version; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -154,17 +154,17 @@ discard block |
||
154 | 154 | ]; |
155 | 155 | |
156 | 156 | if ($this->agent->is('iOS')) { |
157 | - $info['os'] = 'iOS'; |
|
157 | + $info[ 'os' ] = 'iOS'; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | if ($this->agent->is('AndroidOS')) { |
161 | - $info['os'] = 'Android'; |
|
161 | + $info[ 'os' ] = 'Android'; |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | if (is_string($this->version('MicroMessenger'))) { |
165 | - $info['isWechat'] = true; |
|
165 | + $info[ 'isWechat' ] = true; |
|
166 | 166 | } else { |
167 | - unset($info['isWechat']); |
|
167 | + unset($info[ 'isWechat' ]); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | return array_filter($info); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $this->getAppClientData($this->agent->getUserAgent()) |
184 | 184 | ); |
185 | 185 | |
186 | - if (! $data) { |
|
186 | + if (!$data) { |
|
187 | 187 | $this->resetAppClientAttributes(); |
188 | 188 | } |
189 | 189 | |
@@ -199,14 +199,14 @@ discard block |
||
199 | 199 | protected function getAppClientData($userAgent) |
200 | 200 | { |
201 | 201 | if (preg_match('#client\((.+)\)#is', $userAgent, $matches)) { |
202 | - if ($info = json_decode(urlsafe_base64_decode($matches[1]), true)) { |
|
203 | - if (is_array($info) && ! empty($info)) { |
|
202 | + if ($info = json_decode(urlsafe_base64_decode($matches[ 1 ]), true)) { |
|
203 | + if (is_array($info) && !empty($info)) { |
|
204 | 204 | return $info; |
205 | 205 | } |
206 | 206 | } |
207 | 207 | } |
208 | 208 | |
209 | - return []; |
|
209 | + return [ ]; |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -218,29 +218,29 @@ discard block |
||
218 | 218 | protected function getAppClientAttributes($info) |
219 | 219 | { |
220 | 220 | $info = array_filter($info); |
221 | - $data = []; |
|
221 | + $data = [ ]; |
|
222 | 222 | |
223 | 223 | if ( |
224 | - ($data['os'] = array_get($info, 'os')) && |
|
225 | - ($data['osVersion'] = array_get($info, 'osV')) && |
|
226 | - ($data['platform'] = array_get($info, 'pf')) && |
|
227 | - ($data['locale'] = array_get($info, 'loc')) && |
|
228 | - ($data['app'] = array_get($info, 'app')) && |
|
229 | - ($data['appVersion'] = array_get($info, 'appV')) && |
|
230 | - ($data['appChannel'] = array_get($info, 'appC')) && |
|
231 | - ($data['network'] = array_get($info, 'net')) && |
|
232 | - ($data['udid'] = array_get($info, 'udid')) |
|
224 | + ($data[ 'os' ] = array_get($info, 'os')) && |
|
225 | + ($data[ 'osVersion' ] = array_get($info, 'osV')) && |
|
226 | + ($data[ 'platform' ] = array_get($info, 'pf')) && |
|
227 | + ($data[ 'locale' ] = array_get($info, 'loc')) && |
|
228 | + ($data[ 'app' ] = array_get($info, 'app')) && |
|
229 | + ($data[ 'appVersion' ] = array_get($info, 'appV')) && |
|
230 | + ($data[ 'appChannel' ] = array_get($info, 'appC')) && |
|
231 | + ($data[ 'network' ] = array_get($info, 'net')) && |
|
232 | + ($data[ 'udid' ] = array_get($info, 'udid')) |
|
233 | 233 | ) { |
234 | - if ($data['os'] === 'iPhone OS') { |
|
235 | - $data['os'] = 'iOS'; |
|
234 | + if ($data[ 'os' ] === 'iPhone OS') { |
|
235 | + $data[ 'os' ] = 'iOS'; |
|
236 | 236 | } |
237 | 237 | |
238 | - $data['isAppClient'] = true; |
|
238 | + $data[ 'isAppClient' ] = true; |
|
239 | 239 | |
240 | 240 | return array_filter($data); |
241 | 241 | } |
242 | 242 | |
243 | - return []; |
|
243 | + return [ ]; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -249,12 +249,12 @@ discard block |
||
249 | 249 | protected function resetAppClientAttributes() |
250 | 250 | { |
251 | 251 | unset( |
252 | - $this->attributes['app'], |
|
253 | - $this->attributes['appVersion'], |
|
254 | - $this->attributes['appChannel'], |
|
255 | - $this->attributes['network'], |
|
256 | - $this->attributes['udid'], |
|
257 | - $this->attributes['isAppClient'] |
|
252 | + $this->attributes[ 'app' ], |
|
253 | + $this->attributes[ 'appVersion' ], |
|
254 | + $this->attributes[ 'appChannel' ], |
|
255 | + $this->attributes[ 'network' ], |
|
256 | + $this->attributes[ 'udid' ], |
|
257 | + $this->attributes[ 'isAppClient' ] |
|
258 | 258 | ); |
259 | 259 | } |
260 | 260 | |
@@ -267,6 +267,6 @@ discard block |
||
267 | 267 | */ |
268 | 268 | public function __call($method, $parameters) |
269 | 269 | { |
270 | - return call_user_func_array([$this->agent, $method], $parameters); |
|
270 | + return call_user_func_array([ $this->agent, $method ], $parameters); |
|
271 | 271 | } |
272 | 272 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | { |
20 | 20 | $inputs = $request->input(); |
21 | 21 | |
22 | - array_walk_recursive($inputs, function (&$value) { |
|
22 | + array_walk_recursive($inputs, function(&$value) { |
|
23 | 23 | $value = trim($value); |
24 | 24 | }); |
25 | 25 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | { |
40 | 40 | $extension = ExtensionGuesser::getInstance()->guess($mimeType); |
41 | 41 | |
42 | - if (! is_null($extension)) { |
|
42 | + if (!is_null($extension)) { |
|
43 | 43 | if ('jpeg' == $extension) { |
44 | 44 | $extension = 'jpg'; |
45 | 45 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | ]; |
143 | 143 | } |
144 | 144 | |
145 | - return isset($iDeviceModels[$platform]) ? $iDeviceModels[$platform] : $platform; |
|
145 | + return isset($iDeviceModels[ $platform ]) ? $iDeviceModels[ $platform ] : $platform; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -166,9 +166,9 @@ discard block |
||
166 | 166 | 'vip.sina.com' => 'http://mail.sina.com.cn', |
167 | 167 | ]; |
168 | 168 | |
169 | - $domain = strtolower($match[1]); |
|
169 | + $domain = strtolower($match[ 1 ]); |
|
170 | 170 | |
171 | - return isset($list[$domain]) ? $list[$domain] : 'http://mail.'.$domain; |
|
171 | + return isset($list[ $domain ]) ? $list[ $domain ] : 'http://mail.'.$domain; |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $random = str_random(strlen($text)); |
191 | 191 | |
192 | 192 | // 按字符拼接:随机字符串 + 随机字符串异或原文 |
193 | - $tmp = static::sampleEncryption($text, $random, function ($a, $b) { |
|
193 | + $tmp = static::sampleEncryption($text, $random, function($a, $b) { |
|
194 | 194 | return $b.($a ^ $b); |
195 | 195 | }); |
196 | 196 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $tmpLength = strlen($tmp); |
218 | 218 | $result = ''; |
219 | 219 | for ($i = 0; $i < $tmpLength, ($i + 1) < $tmpLength; $i += 2) { |
220 | - $result .= $tmp[$i] ^ $tmp[$i + 1]; |
|
220 | + $result .= $tmp[ $i ] ^ $tmp[ $i + 1 ]; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | return $result; |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $key = (string) $key; |
243 | 243 | $keyLength = strlen($key); |
244 | 244 | if (is_null($callback)) { |
245 | - $callback = function ($a, $b) { |
|
245 | + $callback = function($a, $b) { |
|
246 | 246 | return $a ^ $b; |
247 | 247 | }; |
248 | 248 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $result = ''; |
251 | 251 | $textLength = strlen($text); |
252 | 252 | for ($i = 0; $i < $textLength; $i++) { |
253 | - $tmp = $callback($text[$i], $key[$i % $keyLength], $i); |
|
253 | + $tmp = $callback($text[ $i ], $key[ $i % $keyLength ], $i); |
|
254 | 254 | if (false === $tmp) { |
255 | 255 | break; |
256 | 256 | } |
@@ -285,10 +285,10 @@ discard block |
||
285 | 285 | while ($number >= $charactersLength) { |
286 | 286 | $mod = (int) bcmod($number, $charactersLength); |
287 | 287 | $number = (int) bcdiv($number, $charactersLength); |
288 | - $string = $characters[$mod].$string; |
|
288 | + $string = $characters[ $mod ].$string; |
|
289 | 289 | } |
290 | 290 | |
291 | - return $characters[$number].$string; |
|
291 | + return $characters[ $number ].$string; |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | /** |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | |
311 | 311 | $number = 0; |
312 | 312 | for ($i = 0; $i < $stringLength; $i++) { |
313 | - $index = strpos($characters, $string[$i]); |
|
313 | + $index = strpos($characters, $string[ $i ]); |
|
314 | 314 | $number = (int) bcadd($number, bcmul($index, bcpow($charactersLength, $i))); |
315 | 315 | } |
316 | 316 |