@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
| 32 | 32 | */ |
| 33 | - public function sdkExecute(string $endpoint, array $params = []) |
|
| 33 | + public function sdkExecute(string $endpoint, array $params = [ ]) |
|
| 34 | 34 | { |
| 35 | 35 | // Get api system parameters |
| 36 | 36 | $sysParams = $this->app->apiCommonConfig($endpoint); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | }); |
| 41 | 41 | $params = array_merge($sysParams, $this->json($params)); |
| 42 | 42 | // Set the signature |
| 43 | - $params['sign'] = $this->generateSign($params, $sysParams['sign_type']); |
|
| 43 | + $params[ 'sign' ] = $this->generateSign($params, $sysParams[ 'sign_type' ]); |
|
| 44 | 44 | |
| 45 | 45 | ksort($params); |
| 46 | 46 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * |
| 59 | 59 | * @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
| 60 | 60 | */ |
| 61 | - public function pageExecute(string $endpoint, array $params = [], string $httpMethod = "POST") |
|
| 61 | + public function pageExecute(string $endpoint, array $params = [ ], string $httpMethod = "POST") |
|
| 62 | 62 | { |
| 63 | 63 | |
| 64 | 64 | // Get api system parameters |
@@ -69,13 +69,13 @@ discard block |
||
| 69 | 69 | }); |
| 70 | 70 | $params = array_merge($sysParams, $this->json($params)); |
| 71 | 71 | // Set the signature |
| 72 | - $params['sign'] = $this->generateSign($params, $sysParams['sign_type']); |
|
| 72 | + $params[ 'sign' ] = $this->generateSign($params, $sysParams[ 'sign_type' ]); |
|
| 73 | 73 | |
| 74 | 74 | if ("GET" === strtoupper($httpMethod)) { |
| 75 | 75 | // value urlencode |
| 76 | 76 | $preString = $this->getSignContentUrlencode($params); |
| 77 | 77 | // Stitching GET request string |
| 78 | - $requestUrl = $this->app->getGateway()."?".$preString; |
|
| 78 | + $requestUrl = $this->app->getGateway() . "?" . $preString; |
|
| 79 | 79 | |
| 80 | 80 | return $requestUrl; |
| 81 | 81 | } else { |
@@ -93,21 +93,21 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | protected function buildRequestForm(array $paraTemp) |
| 95 | 95 | { |
| 96 | - $sHtml = "<form id='alipaysubmit' name='alipaysubmit' action='". |
|
| 97 | - $this->app->getGateway()."?charset=".trim($paraTemp['charset']). |
|
| 96 | + $sHtml = "<form id='alipaysubmit' name='alipaysubmit' action='" . |
|
| 97 | + $this->app->getGateway() . "?charset=" . trim($paraTemp[ 'charset' ]) . |
|
| 98 | 98 | "' method='POST'>"; |
| 99 | 99 | |
| 100 | 100 | foreach ($paraTemp as $key => $val) { |
| 101 | 101 | if (false === $this->checkEmpty($val)) { |
| 102 | 102 | $val = str_replace("'", "'", $val); |
| 103 | - $sHtml .= "<input type='hidden' name='".$key."' value='".$val."'/>"; |
|
| 103 | + $sHtml .= "<input type='hidden' name='" . $key . "' value='" . $val . "'/>"; |
|
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | // Submit button control please do not include the name attribute |
| 108 | - $sHtml = $sHtml."<input type='submit' value='ok' style='display:none;''></form>"; |
|
| 108 | + $sHtml = $sHtml . "<input type='submit' value='ok' style='display:none;''></form>"; |
|
| 109 | 109 | |
| 110 | - $sHtml = $sHtml."<script>document.forms['alipaysubmit'].submit();</script>"; |
|
| 110 | + $sHtml = $sHtml . "<script>document.forms['alipaysubmit'].submit();</script>"; |
|
| 111 | 111 | |
| 112 | 112 | return $sHtml; |
| 113 | 113 | } |
@@ -51,17 +51,17 @@ discard block |
||
| 51 | 51 | /** |
| 52 | 52 | * @var array |
| 53 | 53 | */ |
| 54 | - protected $providers = []; |
|
| 54 | + protected $providers = [ ]; |
|
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * @var array |
| 58 | 58 | */ |
| 59 | - protected $userConfig = []; |
|
| 59 | + protected $userConfig = [ ]; |
|
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * @var array |
| 63 | 63 | */ |
| 64 | - protected $defaultConfig = []; |
|
| 64 | + protected $defaultConfig = [ ]; |
|
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * Application constructor. |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function __construct(array $config) |
| 72 | 72 | { |
| 73 | - parent::__construct(['app_client_providers' => $this->providers]); |
|
| 73 | + parent::__construct([ 'app_client_providers' => $this->providers ]); |
|
| 74 | 74 | $this->init($config); |
| 75 | 75 | $this->registerProviders($this->getProviders()); |
| 76 | 76 | } |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function __get($name) |
| 88 | 88 | { |
| 89 | - if (isset($this[$name])) { |
|
| 90 | - return $this[$name]; |
|
| 89 | + if (isset($this[ $name ])) { |
|
| 90 | + return $this[ $name ]; |
|
| 91 | 91 | } |
| 92 | 92 | throw new RuntimeException(sprintf('Identifier "%s" is not defined', $name)); |
| 93 | 93 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $this->config->set('api_method', $endpoint); |
| 134 | 134 | |
| 135 | 135 | return array_merge([ |
| 136 | - 'app_id' => $this->config['sys_params.app_id'], |
|
| 136 | + 'app_id' => $this->config[ 'sys_params.app_id' ], |
|
| 137 | 137 | 'method' => $endpoint, |
| 138 | 138 | 'format' => 'JSON', |
| 139 | 139 | 'charset' => $this->config->get('sys_params.charset', 'utf-8'), |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | 'timestamp' => date('Y-m-d H:i:s'), |
| 143 | 143 | 'version' => '1.0', |
| 144 | 144 | 'app_auth_token' => $this->config->get('sys_params.app_auth_token', ''), |
| 145 | - ], $this->config->get($endpoint.'config', [])); |
|
| 145 | + ], $this->config->get($endpoint . 'config', [ ])); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | public function setEndpointConfig(string $endpoint, array $config) |
| 157 | 157 | { |
| 158 | - $this->config->set($endpoint.'config', $config); |
|
| 158 | + $this->config->set($endpoint . 'config', $config); |
|
| 159 | 159 | |
| 160 | 160 | return $this; |
| 161 | 161 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | public function getEnv(): bool |
| 169 | 169 | { |
| 170 | - return (bool)(isset($this->userConfig['sandbox']) ? $this->userConfig['sandbox'] : false); |
|
| 170 | + return (bool) (isset($this->userConfig[ 'sandbox' ]) ? $this->userConfig[ 'sandbox' ] : false); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -178,9 +178,9 @@ discard block |
||
| 178 | 178 | public function getGateway() |
| 179 | 179 | { |
| 180 | 180 | if ($this->getEnv()) { |
| 181 | - return $this->gateway[self::DEV_ENV]; |
|
| 181 | + return $this->gateway[ self::DEV_ENV ]; |
|
| 182 | 182 | } else { |
| 183 | - return $this->gateway[self::NORMAL_ENV]; |
|
| 183 | + return $this->gateway[ self::NORMAL_ENV ]; |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |