@@ -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_url')) { |
|
| 66 | +if (!function_exists('asset_url')) { |
|
| 67 | 67 | /** |
| 68 | 68 | * Generate an asset URL. |
| 69 | 69 | * |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | -if (! function_exists('cdn_url')) { |
|
| 83 | +if (!function_exists('cdn_url')) { |
|
| 84 | 84 | /** |
| 85 | 85 | * Generate an asset CDN URL. |
| 86 | 86 | * |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | -if (! function_exists('gravatar')) { |
|
| 96 | +if (!function_exists('gravatar')) { |
|
| 97 | 97 | /** |
| 98 | 98 | * Generate a Gravatar url. |
| 99 | 99 | * |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | -if (! function_exists('optimus_encode')) { |
|
| 126 | +if (!function_exists('optimus_encode')) { |
|
| 127 | 127 | /** |
| 128 | 128 | * Encode a number with Optimus. |
| 129 | 129 | * |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | -if (! function_exists('optimus_decode')) { |
|
| 139 | +if (!function_exists('optimus_decode')) { |
|
| 140 | 140 | /** |
| 141 | 141 | * Decode a number with Optimus. |
| 142 | 142 | * |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | -if (! function_exists('random_uuid')) { |
|
| 152 | +if (!function_exists('random_uuid')) { |
|
| 153 | 153 | /** |
| 154 | 154 | * Generate a version 4 (random) UUID. |
| 155 | 155 | * |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | public function handle($request, Closure $next) |
| 18 | 18 | { |
| 19 | - if (! AgentClient::is('AppClient')) { |
|
| 19 | + if (!AgentClient::is('AppClient')) { |
|
| 20 | 20 | return response('Unauthorized Client', 403); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -18,13 +18,13 @@ |
||
| 18 | 18 | * |
| 19 | 19 | * @throws \ElfSundae\Laravel\Api\Exceptions\ApiResponseException |
| 20 | 20 | */ |
| 21 | - public static function verify($credentials = []) |
|
| 21 | + public static function verify($credentials = [ ]) |
|
| 22 | 22 | { |
| 23 | 23 | $response = (new HttpClient('https://webapi.sms.mob.com/')) |
| 24 | - ->formParams(array_merge($credentials, ['appkey' => config('services.mobsms.key')])) |
|
| 24 | + ->formParams(array_merge($credentials, [ 'appkey' => config('services.mobsms.key') ])) |
|
| 25 | 25 | ->fetchJson('/sms/verify', 'POST'); |
| 26 | 26 | |
| 27 | - if (! is_array($response)) { |
|
| 27 | + if (!is_array($response)) { |
|
| 28 | 28 | throw new ActionFailureException('短信网关请求失败'); |
| 29 | 29 | } |
| 30 | 30 | |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public function register() |
| 23 | 23 | { |
| 24 | - $this->app->singleton('optimus', function ($app) { |
|
| 25 | - $config = $app['config']->get('support.optimus'); |
|
| 24 | + $this->app->singleton('optimus', function($app) { |
|
| 25 | + $config = $app[ 'config' ]->get('support.optimus'); |
|
| 26 | 26 | |
| 27 | - return new Optimus($config['prime'], $config['inverse'], $config['random']); |
|
| 27 | + return new Optimus($config[ 'prime' ], $config[ 'inverse' ], $config[ 'random' ]); |
|
| 28 | 28 | }); |
| 29 | 29 | |
| 30 | 30 | $this->app->alias('optimus', Optimus::class); |
@@ -41,6 +41,6 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function provides() |
| 43 | 43 | { |
| 44 | - return ['optimus', Optimus::class]; |
|
| 44 | + return [ 'optimus', Optimus::class ]; |
|
| 45 | 45 | } |
| 46 | 46 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | $this->setupConfiguration(); |
| 19 | 19 | |
| 20 | - array_map([$this->app, 'register'], $this->getServiceProviders()); |
|
| 20 | + array_map([ $this->app, 'register' ], $this->getServiceProviders()); |
|
| 21 | 21 | |
| 22 | 22 | if ($this->app->runningInConsole()) { |
| 23 | 23 | $this->publishes([ |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | protected function setupConfiguration() |
| 37 | 37 | { |
| 38 | - if (! $this->app->configurationIsCached()) { |
|
| 38 | + if (!$this->app->configurationIsCached()) { |
|
| 39 | 39 | $this->configureDefaults(); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -49,20 +49,20 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | protected function configureDefaults() |
| 51 | 51 | { |
| 52 | - $config = $this->app['config']; |
|
| 52 | + $config = $this->app[ 'config' ]; |
|
| 53 | 53 | |
| 54 | 54 | // Append "app.domains" |
| 55 | - $config['app.domains'] = array_map(function ($value) { |
|
| 55 | + $config[ 'app.domains' ] = array_map(function($value) { |
|
| 56 | 56 | if (is_string($domain = parse_url($value, PHP_URL_HOST))) { |
| 57 | 57 | if (str_contains($domain, '.')) { |
| 58 | 58 | return $domain; |
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | - }, $config['support.url']); |
|
| 61 | + }, $config[ 'support.url' ]); |
|
| 62 | 62 | |
| 63 | 63 | // Set "mail.from.name" |
| 64 | - if ($config['mail.from.name'] == 'Example') { |
|
| 65 | - $config['mail.from.name'] = $config['app.name']; |
|
| 64 | + if ($config[ 'mail.from.name' ] == 'Example') { |
|
| 65 | + $config[ 'mail.from.name' ] = $config[ 'app.name' ]; |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
@@ -73,17 +73,17 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | protected function configureForCurrentRequest() |
| 75 | 75 | { |
| 76 | - $config = $this->app['config']; |
|
| 77 | - $request = $this->app['request']; |
|
| 76 | + $config = $this->app[ 'config' ]; |
|
| 77 | + $request = $this->app[ 'request' ]; |
|
| 78 | 78 | |
| 79 | - $identifier = array_search($request->getHost(), $config['app.domains']); |
|
| 79 | + $identifier = array_search($request->getHost(), $config[ 'app.domains' ]); |
|
| 80 | 80 | |
| 81 | 81 | if ($identifier && $config->has('support.cookie_domain.'.$identifier)) { |
| 82 | - $config['session.domain'] = $config['support.cookie_domain.'.$identifier]; |
|
| 82 | + $config[ 'session.domain' ] = $config[ 'support.cookie_domain.'.$identifier ]; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - if ($identifier && is_array($auth = $config['support.auth.'.$identifier])) { |
|
| 86 | - $config['auth.defaults'] = $auth; |
|
| 85 | + if ($identifier && is_array($auth = $config[ 'support.auth.'.$identifier ])) { |
|
| 86 | + $config[ 'auth.defaults' ] = $auth; |
|
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | |
@@ -24,6 +24,6 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | public function setSexAttribute($value) |
| 26 | 26 | { |
| 27 | - $this->attributes['sex'] = Sex::type($value); |
|
| 27 | + $this->attributes[ 'sex' ] = Sex::type($value); |
|
| 28 | 28 | } |
| 29 | 29 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | protected static function bootFreshCreatedAt() |
| 28 | 28 | { |
| 29 | - static::creating(function ($model) { |
|
| 29 | + static::creating(function($model) { |
|
| 30 | 30 | $model->setCreatedAt($model->freshTimestamp()); |
| 31 | 31 | }); |
| 32 | 32 | } |