@@ -54,26 +54,26 @@ discard block |
||
54 | 54 | /** |
55 | 55 | * @var array |
56 | 56 | */ |
57 | - protected $providers = []; |
|
57 | + protected $providers = [ ]; |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * @var array |
61 | 61 | */ |
62 | - protected $userConfig = []; |
|
62 | + protected $userConfig = [ ]; |
|
63 | 63 | |
64 | 64 | /** |
65 | 65 | * @var array |
66 | 66 | */ |
67 | - protected $defaultConfig = []; |
|
67 | + protected $defaultConfig = [ ]; |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Application constructor. |
71 | 71 | * |
72 | 72 | * @param array $config |
73 | 73 | */ |
74 | - public function __construct(array $config = []) |
|
74 | + public function __construct(array $config = [ ]) |
|
75 | 75 | { |
76 | - parent::__construct(['app_client_providers' => $this->providers]); |
|
76 | + parent::__construct([ 'app_client_providers' => $this->providers ]); |
|
77 | 77 | $this->init($config); |
78 | 78 | $this->registerProviders($this->getProviders()); |
79 | 79 | } |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function __get($name) |
91 | 91 | { |
92 | - if (isset($this[$name])) { |
|
93 | - return $this[$name]; |
|
92 | + if (isset($this[ $name ])) { |
|
93 | + return $this[ $name ]; |
|
94 | 94 | } |
95 | 95 | throw new RuntimeException(sprintf('Identifier "%s" is not defined', $name)); |
96 | 96 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $this->config->set('api_method', $endpoint); |
137 | 137 | |
138 | 138 | return array_merge([ |
139 | - 'app_id' => $this->config['sys_params.app_id'], |
|
139 | + 'app_id' => $this->config[ 'sys_params.app_id' ], |
|
140 | 140 | 'method' => $endpoint, |
141 | 141 | 'format' => 'JSON', |
142 | 142 | 'charset' => $this->config->get('sys_params.charset', 'utf-8'), |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | 'timestamp' => date('Y-m-d H:i:s'), |
146 | 146 | 'version' => '1.0', |
147 | 147 | 'app_auth_token' => $this->config->get('sys_params.app_auth_token', ''), |
148 | - ], $this->config->get($endpoint.'config', [])); |
|
148 | + ], $this->config->get($endpoint . 'config', [ ])); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | public function setEndpointConfig(string $endpoint, array $config) |
160 | 160 | { |
161 | - $this->config->set($endpoint.'config', $config); |
|
161 | + $this->config->set($endpoint . 'config', $config); |
|
162 | 162 | |
163 | 163 | return $this; |
164 | 164 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function getEnv(): bool |
172 | 172 | { |
173 | - return (bool)(isset($this->userConfig['sandbox']) ? $this->userConfig['sandbox'] : false); |
|
173 | + return (bool) (isset($this->userConfig[ 'sandbox' ]) ? $this->userConfig[ 'sandbox' ] : false); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | public function getGateway() |
182 | 182 | { |
183 | 183 | if ($this->getEnv()) { |
184 | - return $this->gateway[self::DEV_ENV]; |
|
184 | + return $this->gateway[ self::DEV_ENV ]; |
|
185 | 185 | } else { |
186 | - return $this->gateway[self::NORMAL_ENV]; |
|
186 | + return $this->gateway[ self::NORMAL_ENV ]; |
|
187 | 187 | } |
188 | 188 | } |
189 | 189 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function register(Container $pimple) |
31 | 31 | { |
32 | - $pimple['logger'] = function ($app) { |
|
32 | + $pimple[ 'logger' ] = function ($app) { |
|
33 | 33 | $config = $this->logConfig($app); |
34 | 34 | |
35 | 35 | return new Log($config); |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function logConfig($app) |
47 | 47 | { |
48 | - $logConfig = []; |
|
49 | - if (!empty($app['config']->get('log'))) { |
|
50 | - $logConfig = $app['config']->get('log'); |
|
48 | + $logConfig = [ ]; |
|
49 | + if (!empty($app[ 'config' ]->get('log'))) { |
|
50 | + $logConfig = $app[ 'config' ]->get('log'); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | return array_merge([ |
@@ -42,6 +42,6 @@ |
||
42 | 42 | */ |
43 | 43 | public function __call($name, $arguments) |
44 | 44 | { |
45 | - return call_user_func_array([$this['base'], $name], $arguments); |
|
45 | + return call_user_func_array([ $this[ 'base' ], $name ], $arguments); |
|
46 | 46 | } |
47 | 47 | } |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | ], $params); |
40 | 40 | |
41 | 41 | $this->app->setEndpointConfig($method, [ |
42 | - 'return_url' => $returnUrl ?: $this->app['config']->get('return_url'), |
|
43 | - 'notify_url' => $this->app['config']->get('notify_url'), |
|
42 | + 'return_url' => $returnUrl ?: $this->app[ 'config' ]->get('return_url'), |
|
43 | + 'notify_url' => $this->app[ 'config' ]->get('notify_url'), |
|
44 | 44 | ]); |
45 | 45 | |
46 | 46 | return $this->sdkExecute($method, [ |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | ], $params); |
69 | 69 | |
70 | 70 | $this->app->setEndpointConfig($method, [ |
71 | - 'return_url' => $returnUrl ?: $this->app['config']->get('return_url'), |
|
72 | - 'notify_url' => $this->app['config']->get('notify_url'), |
|
71 | + 'return_url' => $returnUrl ?: $this->app[ 'config' ]->get('return_url'), |
|
72 | + 'notify_url' => $this->app[ 'config' ]->get('notify_url'), |
|
73 | 73 | ]); |
74 | 74 | |
75 | 75 | return $this->pageExecute($method, [ |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | 'product_code' => 'FAST_INSTANT_TRADE_PAY', |
97 | 97 | ], $params); |
98 | 98 | $this->app->setEndpointConfig($method, [ |
99 | - 'return_url' => $returnUrl ?: $this->app['config']->get('return_url'), |
|
100 | - 'notify_url' => $this->app['config']->get('notify_url'), |
|
99 | + 'return_url' => $returnUrl ?: $this->app[ 'config' ]->get('return_url'), |
|
100 | + 'notify_url' => $this->app[ 'config' ]->get('notify_url'), |
|
101 | 101 | ]); |
102 | 102 | |
103 | 103 | return $this->pageExecute($method, [ |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public function getBaseInfo() |
27 | 27 | { |
28 | 28 | $method = 'alipay.open.mini.baseinfo.query'; |
29 | - $params = []; |
|
29 | + $params = [ ]; |
|
30 | 30 | |
31 | 31 | return $this->request($method, [ |
32 | 32 | 'biz_content' => $params, |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | public function getCategoryList() |
151 | 151 | { |
152 | 152 | $method = 'alipay.open.mini.category.query'; |
153 | - $params = []; |
|
153 | + $params = [ ]; |
|
154 | 154 | |
155 | 155 | return $this->request($method, [ |
156 | 156 | 'biz_content' => $params, |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | public function faceAuthenticationResultsQuery() |
170 | 170 | { |
171 | 171 | $method = 'zoloz.identification.customer.certifyzhub.query'; |
172 | - $params = []; |
|
172 | + $params = [ ]; |
|
173 | 173 | |
174 | 174 | return $this->request($method, [ |
175 | 175 | 'biz_content' => $params, |
@@ -197,7 +197,7 @@ |
||
197 | 197 | public function getList() |
198 | 198 | { |
199 | 199 | $method = 'alipay.open.mini.version.list.query'; |
200 | - $params = []; |
|
200 | + $params = [ ]; |
|
201 | 201 | |
202 | 202 | return $this->request($method, [ |
203 | 203 | 'biz_content' => $params, |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | class Alipay |
27 | 27 | { |
28 | - protected static $config = []; |
|
28 | + protected static $config = [ ]; |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * make. |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @throws \EasyAlipay\Kernel\Exceptions\ApplicationException |
39 | 39 | */ |
40 | - public static function make(string $name, array $config = []) |
|
40 | + public static function make(string $name, array $config = [ ]) |
|
41 | 41 | { |
42 | 42 | $namespace = Str::studly($name); |
43 | - $application = __NAMESPACE__."\\{$namespace}\\Application"; |
|
43 | + $application = __NAMESPACE__ . "\\{$namespace}\\Application"; |
|
44 | 44 | |
45 | 45 | if (class_exists($application)) { |
46 | 46 | $config = array_replace_recursive(self::$config, $config); |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | public function run(Closure $closure): Response |
73 | 73 | { |
74 | 74 | try { |
75 | - $response = \call_user_func($closure, $this->getMessage(), [$this, 'response']); |
|
75 | + $response = \call_user_func($closure, $this->getMessage(), [ $this, 'response' ]); |
|
76 | 76 | } catch (\Exception $e) { |
77 | - $this->app['logger']->error('Alipay asynchronous notification fatal error:'.$e->getMessage()); |
|
77 | + $this->app[ 'logger' ]->error('Alipay asynchronous notification fatal error:' . $e->getMessage()); |
|
78 | 78 | $response = $this->response(false); |
79 | 79 | } |
80 | 80 | |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function getMessage(): Collection |
109 | 109 | { |
110 | - $signData = $request = $this->app['request']->request->all(); |
|
111 | - unset($signData['sign'], $signData['sign_type']); |
|
112 | - if ($this->verify($this->getSignContentUrlencode($signData), $request['sign'], $request['sign_type'])) { |
|
110 | + $signData = $request = $this->app[ 'request' ]->request->all(); |
|
111 | + unset($signData[ 'sign' ], $signData[ 'sign_type' ]); |
|
112 | + if ($this->verify($this->getSignContentUrlencode($signData), $request[ 'sign' ], $request[ 'sign_type' ])) { |
|
113 | 113 | return new Collection($request); |
114 | 114 | } |
115 | 115 |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | { |
31 | 31 | $method = 'alipay.system.oauth.token'; |
32 | 32 | |
33 | - $param = []; |
|
33 | + $param = [ ]; |
|
34 | 34 | |
35 | 35 | if ($grantType !== 'authorization_code') { |
36 | - $param['refresh_token'] = $code; |
|
36 | + $param[ 'refresh_token' ] = $code; |
|
37 | 37 | } else { |
38 | - $param['code'] = $code; |
|
38 | + $param[ 'code' ] = $code; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $params = array_merge([ |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | $url = 'https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?'; |
68 | 68 | |
69 | - return $url.http_build_query($params); |
|
69 | + return $url . http_build_query($params); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | 'state' => $state, |
112 | 112 | ]; |
113 | 113 | $this->app->setEndpointConfig($method, [ |
114 | - 'return_url' => $returnUrl ?: $this->app['config']->get('return_url'), |
|
114 | + 'return_url' => $returnUrl ?: $this->app[ 'config' ]->get('return_url'), |
|
115 | 115 | ]); |
116 | 116 | |
117 | 117 | return $this->request($method, [ |