@@ -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 |
@@ -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 | } |
@@ -19,7 +19,6 @@ discard block |
||
19 | 19 | * |
20 | 20 | * This is a great spot to send exceptions to Sentry, Bugsnag, etc. |
21 | 21 | * |
22 | - * @param \Exception $exception |
|
23 | 22 | * @return void |
24 | 23 | */ |
25 | 24 | public function report(Exception $e) |
@@ -194,7 +193,7 @@ discard block |
||
194 | 193 | /** |
195 | 194 | * Create an API response. |
196 | 195 | * |
197 | - * @param mixed $message |
|
196 | + * @param string $message |
|
198 | 197 | * @param int $code |
199 | 198 | * @param \Exception $e |
200 | 199 | * @return \ElfSundae\Laravel\Api\Http\ApiResponse |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | ]; |
60 | 60 | |
61 | 61 | if ($this->container->runningInConsole()) { |
62 | - $info['Command'] = implode(' ', $request->server('argv', [])); |
|
62 | + $info[ 'Command' ] = implode(' ', $request->server('argv', [ ])); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | return $info; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | protected function convertExceptionToResponse(Exception $e) |
173 | 173 | { |
174 | - if (request()->expectsJson() && ! $this->container->make('config')->get('app.debug')) { |
|
174 | + if (request()->expectsJson() && !$this->container->make('config')->get('app.debug')) { |
|
175 | 175 | return $this->convertExceptionToApiResponse($e); |
176 | 176 | } |
177 | 177 |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $this->notification(func_get_arg(2)); |
48 | 48 | } |
49 | 49 | } else { |
50 | - call_user_func_array([$this, 'add'], array_slice(func_get_args(), 1)); |
|
50 | + call_user_func_array([ $this, 'add' ], array_slice(func_get_args(), 1)); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | } |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function __call($method, $parameters) |
91 | 91 | { |
92 | - if (! $this->message) { |
|
92 | + if (!$this->message) { |
|
93 | 93 | $this->message = new Message($this->client ?: bearychat()); |
94 | 94 | } |
95 | 95 | |
96 | - call_user_func_array([$this->message, $method], $parameters); |
|
96 | + call_user_func_array([ $this->message, $method ], $parameters); |
|
97 | 97 | |
98 | 98 | return $this; |
99 | 99 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | $this->setupConfigurations(); |
31 | 31 | |
32 | - array_map([$this->app, 'register'], $this->getServiceProviders()); |
|
32 | + array_map([ $this->app, 'register' ], $this->getServiceProviders()); |
|
33 | 33 | |
34 | 34 | if ($this->app->runningInConsole()) { |
35 | 35 | $this->registerForConsole(); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | protected function setupConfigurations() |
45 | 45 | { |
46 | - if (! $this->app->configurationIsCached()) { |
|
46 | + if (!$this->app->configurationIsCached()) { |
|
47 | 47 | $this->configureDefaults(); |
48 | 48 | } |
49 | 49 | |
@@ -57,16 +57,16 @@ discard block |
||
57 | 57 | */ |
58 | 58 | protected function configureDefaults() |
59 | 59 | { |
60 | - $config = $this->app['config']; |
|
60 | + $config = $this->app[ 'config' ]; |
|
61 | 61 | |
62 | 62 | // Append "app.domains" |
63 | - $config['app.domains'] = array_map(function ($value) { |
|
63 | + $config[ 'app.domains' ] = array_map(function($value) { |
|
64 | 64 | if (is_string($domain = parse_url($value, PHP_URL_HOST))) { |
65 | 65 | if (str_contains($domain, '.')) { |
66 | 66 | return $domain; |
67 | 67 | } |
68 | 68 | } |
69 | - }, $config['support.url']); |
|
69 | + }, $config[ 'support.url' ]); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -76,17 +76,17 @@ discard block |
||
76 | 76 | */ |
77 | 77 | protected function configureForCurrentRequest() |
78 | 78 | { |
79 | - $config = $this->app['config']; |
|
80 | - $request = $this->app['request']; |
|
79 | + $config = $this->app[ 'config' ]; |
|
80 | + $request = $this->app[ 'request' ]; |
|
81 | 81 | |
82 | - $identifier = array_search($request->getHost(), $config['app.domains']); |
|
82 | + $identifier = array_search($request->getHost(), $config[ 'app.domains' ]); |
|
83 | 83 | |
84 | 84 | if ($identifier && $config->has('support.cookie_domain.'.$identifier)) { |
85 | - $config['session.domain'] = $config['support.cookie_domain.'.$identifier]; |
|
85 | + $config[ 'session.domain' ] = $config[ 'support.cookie_domain.'.$identifier ]; |
|
86 | 86 | } |
87 | 87 | |
88 | - if ($identifier && is_array($auth = $config['support.auth.'.$identifier])) { |
|
89 | - $config['auth.defaults'] = $auth; |
|
88 | + if ($identifier && is_array($auth = $config[ 'support.auth.'.$identifier ])) { |
|
89 | + $config[ 'auth.defaults' ] = $auth; |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | protected function getServiceProviders() |
99 | 99 | { |
100 | - $providers = []; |
|
100 | + $providers = [ ]; |
|
101 | 101 | |
102 | 102 | if ($this->app->isLocal()) { |
103 | 103 | array_push( |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | $router = $this->app->make('router'); |
37 | 37 | |
38 | 38 | $router->macro('modelWithOptimusHashid', |
39 | - function ($key, $class, Closure $callback = null) use ($router) { |
|
40 | - $router->bind($key, function ($value) use ($router, $class, $callback) { |
|
39 | + function($key, $class, Closure $callback = null) use ($router) { |
|
40 | + $router->bind($key, function($value) use ($router, $class, $callback) { |
|
41 | 41 | if (is_null($value)) { |
42 | 42 | return; |
43 | 43 | } |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function register() |
67 | 67 | { |
68 | - $this->app->singleton('optimus', function ($app) { |
|
69 | - $config = $app['config']->get('support.optimus'); |
|
68 | + $this->app->singleton('optimus', function($app) { |
|
69 | + $config = $app[ 'config' ]->get('support.optimus'); |
|
70 | 70 | |
71 | - return new Optimus($config['prime'], $config['inverse'], $config['random']); |
|
71 | + return new Optimus($config[ 'prime' ], $config[ 'inverse' ], $config[ 'random' ]); |
|
72 | 72 | }); |
73 | 73 | |
74 | 74 | $this->app->alias('optimus', Optimus::class); |
@@ -85,6 +85,6 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function provides() |
87 | 87 | { |
88 | - return ['optimus', Optimus::class]; |
|
88 | + return [ 'optimus', Optimus::class ]; |
|
89 | 89 | } |
90 | 90 | } |
@@ -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('random_uuid')) { |
|
126 | +if (!function_exists('random_uuid')) { |
|
127 | 127 | /** |
128 | 128 | * Generate a version 4 (random) UUID. |
129 | 129 | * |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! function_exists('optimus_encode')) { |
|
3 | +if (!function_exists('optimus_encode')) { |
|
4 | 4 | /** |
5 | 5 | * Encode a number with Optimus. |
6 | 6 | * |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | } |
14 | 14 | } |
15 | 15 | |
16 | -if (! function_exists('optimus_decode')) { |
|
16 | +if (!function_exists('optimus_decode')) { |
|
17 | 17 | /** |
18 | 18 | * Decode a number with Optimus. |
19 | 19 | * |