@@ -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([ |
@@ -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, [ |
@@ -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 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | { |
| 50 | 50 | $method = 'alipay.fund.auth.operation.cancel'; |
| 51 | 51 | $this->app->setEndpointConfig($method, [ |
| 52 | - 'notify_url' => $this->app['config']->get('notify_url'), |
|
| 52 | + 'notify_url' => $this->app[ 'config' ]->get('notify_url'), |
|
| 53 | 53 | ]); |
| 54 | 54 | |
| 55 | 55 | return $this->request($method, [ |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | $method = 'alipay.fund.auth.order.freeze'; |
| 74 | 74 | $this->app->setEndpointConfig($method, [ |
| 75 | - 'notify_url' => $this->app['config']->get('notify_url'), |
|
| 75 | + 'notify_url' => $this->app[ 'config' ]->get('notify_url'), |
|
| 76 | 76 | ]); |
| 77 | 77 | |
| 78 | 78 | return $this->request($method, [ |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | }); |
| 110 | 110 | |
| 111 | 111 | $this->app->setEndpointConfig($method, [ |
| 112 | - 'notify_url' => $this->app['config']->get('notify_url'), |
|
| 112 | + 'notify_url' => $this->app[ 'config' ]->get('notify_url'), |
|
| 113 | 113 | ]); |
| 114 | 114 | |
| 115 | 115 | return $this->request($method, [ |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | { |
| 133 | 133 | $method = 'alipay.fund.auth.order.app.freeze'; |
| 134 | 134 | $this->app->setEndpointConfig($method, [ |
| 135 | - 'notify_url' => $this->app['config']->get('notify_url'), |
|
| 135 | + 'notify_url' => $this->app[ 'config' ]->get('notify_url'), |
|
| 136 | 136 | ]); |
| 137 | 137 | |
| 138 | 138 | return $this->request($method, [ |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | { |
| 156 | 156 | $method = 'alipay.fund.auth.order.voucher.create'; |
| 157 | 157 | $this->app->setEndpointConfig($method, [ |
| 158 | - 'notify_url' => $this->app['config']->get('notify_url'), |
|
| 158 | + 'notify_url' => $this->app[ 'config' ]->get('notify_url'), |
|
| 159 | 159 | ]); |
| 160 | 160 | |
| 161 | 161 | return $this->request($method, [ |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | $method = 'alipay.fund.trans.app.pay'; |
| 280 | 280 | |
| 281 | 281 | $this->app->setEndpointConfig($method, [ |
| 282 | - 'return_url' => $this->app['config']->get('return_url'), |
|
| 282 | + 'return_url' => $this->app[ 'config' ]->get('return_url'), |
|
| 283 | 283 | ]); |
| 284 | 284 | |
| 285 | 285 | return $this->request($method, [ |
@@ -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 | } |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | ]; |
| 36 | 36 | |
| 37 | 37 | if ($grantType !== 'authorization_code') { |
| 38 | - $params['refresh_token'] = $code; |
|
| 38 | + $params[ 'refresh_token' ] = $code; |
|
| 39 | 39 | } else { |
| 40 | - $params['code'] = $code; |
|
| 40 | + $params[ 'code' ] = $code; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | return $this->request($method, $params); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | $url = 'https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?'; |
| 66 | 66 | |
| 67 | - return $url.http_build_query($params); |
|
| 67 | + return $url . http_build_query($params); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | 'state' => $state, |
| 110 | 110 | ]; |
| 111 | 111 | $this->app->setEndpointConfig($method, [ |
| 112 | - 'return_url' => $returnUrl ?: $this->app['config']->get('return_url'), |
|
| 112 | + 'return_url' => $returnUrl ?: $this->app[ 'config' ]->get('return_url'), |
|
| 113 | 113 | ]); |
| 114 | 114 | |
| 115 | 115 | return $this->request($method, [ |
@@ -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, |
@@ -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 | } |