@@ -19,15 +19,15 @@ |
||
19 | 19 | */ |
20 | 20 | public function register() |
21 | 21 | { |
22 | - $this->app->singleton(Optimus::class, function ($app) { |
|
23 | - $config = $app['config']->get('support.optimus'); |
|
22 | + $this->app->singleton(Optimus::class, function($app) { |
|
23 | + $config = $app[ 'config' ]->get('support.optimus'); |
|
24 | 24 | |
25 | - return new Optimus($config['prime'], $config['inverse'], $config['random']); |
|
25 | + return new Optimus($config[ 'prime' ], $config[ 'inverse' ], $config[ 'random' ]); |
|
26 | 26 | }); |
27 | 27 | |
28 | 28 | $this->app->alias(Optimus::class, 'optimus'); |
29 | 29 | |
30 | - $this->app->singleton('command.optimus.generate', function () { |
|
30 | + $this->app->singleton('command.optimus.generate', function() { |
|
31 | 31 | return new GenerateOptimusCommand; |
32 | 32 | }); |
33 | 33 |
@@ -18,13 +18,13 @@ |
||
18 | 18 | */ |
19 | 19 | public function register() |
20 | 20 | { |
21 | - $this->app->singleton(XgPusher::class, function ($app) { |
|
22 | - $config = $app['config']['support.xgpush']; |
|
21 | + $this->app->singleton(XgPusher::class, function($app) { |
|
22 | + $config = $app[ 'config' ][ 'support.xgpush' ]; |
|
23 | 23 | |
24 | - return (new XgPusher($config['key'], $config['secret'])) |
|
25 | - ->setEnvironment($config['environment']) |
|
26 | - ->setCustomKey($config['custom_key']) |
|
27 | - ->setAccountPrefix($config['account_prefix']); |
|
24 | + return (new XgPusher($config[ 'key' ], $config[ 'secret' ])) |
|
25 | + ->setEnvironment($config[ 'environment' ]) |
|
26 | + ->setCustomKey($config[ 'custom_key' ]) |
|
27 | + ->setAccountPrefix($config[ 'account_prefix' ]); |
|
28 | 28 | }); |
29 | 29 | |
30 | 30 | $this->app->alias(XgPusher::class, 'xgpusher'); |
@@ -15,7 +15,7 @@ |
||
15 | 15 | base_path('vendor/mews/captcha/config/captcha.php') => config_path('captcha.php'), |
16 | 16 | ], 'config'); |
17 | 17 | |
18 | - $this->app['validator']->extend('captcha', function ($attribute, $value, $parameters) { |
|
18 | + $this->app[ 'validator' ]->extend('captcha', function($attribute, $value, $parameters) { |
|
19 | 19 | return captcha_check($value); |
20 | 20 | }); |
21 | 21 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | public function register() |
15 | 15 | { |
16 | - if (! $this->app->configurationIsCached()) { |
|
16 | + if (!$this->app->configurationIsCached()) { |
|
17 | 17 | $this->configureDefaults(); |
18 | 18 | } |
19 | 19 | |
@@ -27,20 +27,20 @@ discard block |
||
27 | 27 | */ |
28 | 28 | protected function configureDefaults() |
29 | 29 | { |
30 | - $config = $this->app['config']; |
|
30 | + $config = $this->app[ 'config' ]; |
|
31 | 31 | |
32 | 32 | // Append "app.domains" |
33 | - $config['app.domains'] = array_map(function ($value) { |
|
33 | + $config[ 'app.domains' ] = array_map(function($value) { |
|
34 | 34 | if (is_string($domain = parse_url($value, PHP_URL_HOST))) { |
35 | 35 | if (str_contains($domain, '.')) { |
36 | 36 | return $domain; |
37 | 37 | } |
38 | 38 | } |
39 | - }, $config['support.url']); |
|
39 | + }, $config[ 'support.url' ]); |
|
40 | 40 | |
41 | 41 | // Set "mail.from.name" |
42 | - if ($config['mail.from.name'] == 'Example') { |
|
43 | - $config['mail.from.name'] = $config['app.name']; |
|
42 | + if ($config[ 'mail.from.name' ] == 'Example') { |
|
43 | + $config[ 'mail.from.name' ] = $config[ 'app.name' ]; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
@@ -49,19 +49,19 @@ discard block |
||
49 | 49 | */ |
50 | 50 | protected function configureForCurrentRequest() |
51 | 51 | { |
52 | - $config = $this->app['config']; |
|
53 | - $request = $this->app['request']; |
|
52 | + $config = $this->app[ 'config' ]; |
|
53 | + $request = $this->app[ 'request' ]; |
|
54 | 54 | |
55 | - $identifier = array_search($request->getHost(), $config['app.domains']); |
|
55 | + $identifier = array_search($request->getHost(), $config[ 'app.domains' ]); |
|
56 | 56 | |
57 | 57 | // Configure the cookie domain |
58 | 58 | if ($identifier && $config->has('support.cookie_domain.'.$identifier)) { |
59 | - $config['session.domain'] = $config['support.cookie_domain.'.$identifier]; |
|
59 | + $config[ 'session.domain' ] = $config[ 'support.cookie_domain.'.$identifier ]; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | // Configure the auth defaults |
63 | - if ($identifier && is_array($auth = $config['support.auth.'.$identifier])) { |
|
64 | - $config['auth.defaults'] = $auth; |
|
63 | + if ($identifier && is_array($auth = $config[ 'support.auth.'.$identifier ])) { |
|
64 | + $config[ 'auth.defaults' ] = $auth; |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | } |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace ElfSundae\Laravel\Support\Services\Agent; |
4 | 4 | |
5 | -use Illuminate\Support\Arr; |
|
6 | 5 | use Jenssegers\Agent\Agent; |
7 | 6 | use Illuminate\Support\Fluent; |
8 | 7 | use ElfSundae\Laravel\Support\Traits\FluentArrayAccess; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | { |
81 | 81 | $version = $this->agent->version($propertyName, $type); |
82 | 82 | |
83 | - return is_string($version) ? str_replace(['_', '+'], '.', $version) : $version; |
|
83 | + return is_string($version) ? str_replace([ '_', '+' ], '.', $version) : $version; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -155,15 +155,15 @@ discard block |
||
155 | 155 | ]; |
156 | 156 | |
157 | 157 | if ($this->agent->is('iOS')) { |
158 | - $info['os'] = 'iOS'; |
|
158 | + $info[ 'os' ] = 'iOS'; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | if ($this->agent->is('AndroidOS')) { |
162 | - $info['os'] = 'Android'; |
|
162 | + $info[ 'os' ] = 'Android'; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | if (is_string($this->version('MicroMessenger'))) { |
166 | - $info['isWechat'] = true; |
|
166 | + $info[ 'isWechat' ] = true; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | return array_filter($info); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $this->getAppClientData($this->agent->getUserAgent()) |
183 | 183 | ); |
184 | 184 | |
185 | - if (! $data) { |
|
185 | + if (!$data) { |
|
186 | 186 | $this->resetAppClientAttributes(); |
187 | 187 | } |
188 | 188 | |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | protected function getAppClientData($userAgent) |
199 | 199 | { |
200 | 200 | if (preg_match('#client\((.+)\)#is', $userAgent, $matches)) { |
201 | - if ($info = json_decode(urlsafe_base64_decode($matches[1]), true)) { |
|
202 | - if (is_array($info) && ! empty($info)) { |
|
201 | + if ($info = json_decode(urlsafe_base64_decode($matches[ 1 ]), true)) { |
|
202 | + if (is_array($info) && !empty($info)) { |
|
203 | 203 | return $info; |
204 | 204 | } |
205 | 205 | } |
206 | 206 | } |
207 | 207 | |
208 | - return []; |
|
208 | + return [ ]; |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -217,29 +217,29 @@ discard block |
||
217 | 217 | protected function getAppClientAttributes($info) |
218 | 218 | { |
219 | 219 | $info = array_filter($info); |
220 | - $data = []; |
|
220 | + $data = [ ]; |
|
221 | 221 | |
222 | 222 | if ( |
223 | - ($data['os'] = array_get($info, 'os')) && |
|
224 | - ($data['osVersion'] = array_get($info, 'osV')) && |
|
225 | - ($data['platform'] = array_get($info, 'pf')) && |
|
226 | - ($data['locale'] = array_get($info, 'loc')) && |
|
227 | - ($data['app'] = array_get($info, 'app')) && |
|
228 | - ($data['appVersion'] = array_get($info, 'appV')) && |
|
229 | - ($data['appChannel'] = array_get($info, 'appC')) && |
|
230 | - ($data['network'] = array_get($info, 'net')) && |
|
231 | - ($data['udid'] = array_get($info, 'udid')) |
|
223 | + ($data[ 'os' ] = array_get($info, 'os')) && |
|
224 | + ($data[ 'osVersion' ] = array_get($info, 'osV')) && |
|
225 | + ($data[ 'platform' ] = array_get($info, 'pf')) && |
|
226 | + ($data[ 'locale' ] = array_get($info, 'loc')) && |
|
227 | + ($data[ 'app' ] = array_get($info, 'app')) && |
|
228 | + ($data[ 'appVersion' ] = array_get($info, 'appV')) && |
|
229 | + ($data[ 'appChannel' ] = array_get($info, 'appC')) && |
|
230 | + ($data[ 'network' ] = array_get($info, 'net')) && |
|
231 | + ($data[ 'udid' ] = array_get($info, 'udid')) |
|
232 | 232 | ) { |
233 | - if ($data['os'] === 'iPhone OS') { |
|
234 | - $data['os'] = 'iOS'; |
|
233 | + if ($data[ 'os' ] === 'iPhone OS') { |
|
234 | + $data[ 'os' ] = 'iOS'; |
|
235 | 235 | } |
236 | 236 | |
237 | - $data['isAppClient'] = true; |
|
237 | + $data[ 'isAppClient' ] = true; |
|
238 | 238 | |
239 | 239 | return array_filter($data); |
240 | 240 | } |
241 | 241 | |
242 | - return []; |
|
242 | + return [ ]; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
@@ -248,12 +248,12 @@ discard block |
||
248 | 248 | protected function resetAppClientAttributes() |
249 | 249 | { |
250 | 250 | unset( |
251 | - $this->attributes['app'], |
|
252 | - $this->attributes['appVersion'], |
|
253 | - $this->attributes['appChannel'], |
|
254 | - $this->attributes['network'], |
|
255 | - $this->attributes['udid'], |
|
256 | - $this->attributes['isAppClient'] |
|
251 | + $this->attributes[ 'app' ], |
|
252 | + $this->attributes[ 'appVersion' ], |
|
253 | + $this->attributes[ 'appChannel' ], |
|
254 | + $this->attributes[ 'network' ], |
|
255 | + $this->attributes[ 'udid' ], |
|
256 | + $this->attributes[ 'isAppClient' ] |
|
257 | 257 | ); |
258 | 258 | } |
259 | 259 | |
@@ -266,6 +266,6 @@ discard block |
||
266 | 266 | */ |
267 | 267 | public function __call($method, $parameters) |
268 | 268 | { |
269 | - return call_user_func_array([$this->agent, $method], $parameters); |
|
269 | + return call_user_func_array([ $this->agent, $method ], $parameters); |
|
270 | 270 | } |
271 | 271 | } |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | use Ramsey\Uuid\Uuid; |
4 | 4 | |
5 | -if (! function_exists('is_domain')) { |
|
5 | +if (!function_exists('is_domain')) { |
|
6 | 6 | /** |
7 | 7 | * Determines the current domain equals to the given domain identifier. |
8 | 8 | * |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | } |
16 | 16 | } |
17 | 17 | |
18 | -if (! function_exists('app_url')) { |
|
18 | +if (!function_exists('app_url')) { |
|
19 | 19 | /** |
20 | 20 | * Generate an URL for the application. |
21 | 21 | * |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | function app_url($path = '', $parameters = null, $identifier = 'site') |
28 | 28 | { |
29 | 29 | $path = trim($path, '/'); |
30 | - if (! empty($path) && ! starts_with($path, ['?', '&', '#'])) { |
|
30 | + if (!empty($path) && !starts_with($path, [ '?', '&', '#' ])) { |
|
31 | 31 | $path = '/'.$path; |
32 | 32 | } |
33 | 33 | |
34 | - if (! is_null($parameters)) { |
|
34 | + if (!is_null($parameters)) { |
|
35 | 35 | $query = http_build_query($parameters); |
36 | - if (! empty($query)) { |
|
37 | - $path .= (str_contains($path, ['?', '&', '#']) ? '&' : '?').$query; |
|
36 | + if (!empty($query)) { |
|
37 | + $path .= (str_contains($path, [ '?', '&', '#' ]) ? '&' : '?').$query; |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | -if (! function_exists('revision')) { |
|
49 | +if (!function_exists('revision')) { |
|
50 | 50 | /** |
51 | 51 | * Get the revisioned asset path. |
52 | 52 | * |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
66 | -if (! function_exists('asset_from')) { |
|
66 | +if (!function_exists('asset_from')) { |
|
67 | 67 | /** |
68 | 68 | * Generate the URL to an asset from a custom root domain such as CDN, etc. |
69 | 69 | * |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | -if (! function_exists('asset_url')) { |
|
81 | +if (!function_exists('asset_url')) { |
|
82 | 82 | /** |
83 | 83 | * Generate an asset URL. |
84 | 84 | * |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
98 | -if (! function_exists('cdn_url')) { |
|
98 | +if (!function_exists('cdn_url')) { |
|
99 | 99 | /** |
100 | 100 | * Generate an asset CDN URL. |
101 | 101 | * |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | } |
109 | 109 | } |
110 | 110 | |
111 | -if (! function_exists('gravatar')) { |
|
111 | +if (!function_exists('gravatar')) { |
|
112 | 112 | /** |
113 | 113 | * Generate a Gravatar url. |
114 | 114 | * |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | -if (! function_exists('optimus_encode')) { |
|
141 | +if (!function_exists('optimus_encode')) { |
|
142 | 142 | /** |
143 | 143 | * Encode a number with Optimus. |
144 | 144 | * |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | -if (! function_exists('optimus_decode')) { |
|
154 | +if (!function_exists('optimus_decode')) { |
|
155 | 155 | /** |
156 | 156 | * Decode a number with Optimus. |
157 | 157 | * |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
167 | -if (! function_exists('random_uuid')) { |
|
167 | +if (!function_exists('random_uuid')) { |
|
168 | 168 | /** |
169 | 169 | * Generate a version 4 (random) UUID. |
170 | 170 | * |
@@ -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 |