@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | foreach ($params as $k => $v) { |
| 53 | 53 | if (false === $this->checkEmpty($v) && "@" !== substr($v, 0, 1)) { |
| 54 | 54 | if ($i === 0) { |
| 55 | - $stringToBeSigned .= "$k"."="."$v"; |
|
| 55 | + $stringToBeSigned .= "$k" . "=" . "$v"; |
|
| 56 | 56 | } else { |
| 57 | - $stringToBeSigned .= "&"."$k"."="."$v"; |
|
| 57 | + $stringToBeSigned .= "&" . "$k" . "=" . "$v"; |
|
| 58 | 58 | } |
| 59 | 59 | $i++; |
| 60 | 60 | } |
@@ -81,9 +81,9 @@ discard block |
||
| 81 | 81 | foreach ($params as $k => $v) { |
| 82 | 82 | if (false === $this->checkEmpty($v) && "@" !== substr($v, 0, 1)) { |
| 83 | 83 | if ($i === 0) { |
| 84 | - $stringToBeSigned .= "$k"."=".urlencode($v); |
|
| 84 | + $stringToBeSigned .= "$k" . "=" . urlencode($v); |
|
| 85 | 85 | } else { |
| 86 | - $stringToBeSigned .= "&"."$k"."=".urlencode($v); |
|
| 86 | + $stringToBeSigned .= "&" . "$k" . "=" . urlencode($v); |
|
| 87 | 87 | } |
| 88 | 88 | $i++; |
| 89 | 89 | } |
@@ -106,11 +106,11 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | protected function sign($data, $signType = "RSA2") |
| 108 | 108 | { |
| 109 | - $rsaPrivateKeyFilePath = $this->app['config']->get('private_key_path'); |
|
| 109 | + $rsaPrivateKeyFilePath = $this->app[ 'config' ]->get('private_key_path'); |
|
| 110 | 110 | if ($this->checkEmpty($rsaPrivateKeyFilePath)) { |
| 111 | - $priKey = $this->app['config']['private_key']; |
|
| 112 | - $priKey = "-----BEGIN RSA PRIVATE KEY-----\n". |
|
| 113 | - wordwrap($priKey, 64, "\n", true). |
|
| 111 | + $priKey = $this->app[ 'config' ][ 'private_key' ]; |
|
| 112 | + $priKey = "-----BEGIN RSA PRIVATE KEY-----\n" . |
|
| 113 | + wordwrap($priKey, 64, "\n", true) . |
|
| 114 | 114 | "\n-----END RSA PRIVATE KEY-----"; |
| 115 | 115 | } else { |
| 116 | 116 | $priKey = file_get_contents($rsaPrivateKeyFilePath); |
@@ -173,13 +173,13 @@ discard block |
||
| 173 | 173 | { |
| 174 | 174 | $response_suffix = '_response'; |
| 175 | 175 | $error_respones = 'error_response'; |
| 176 | - $apiMethod = $this->app['config']['api_method'] ?? $apiMethod; |
|
| 177 | - $rootNodeName = str_replace(".", "_", $apiMethod).$response_suffix; |
|
| 176 | + $apiMethod = $this->app[ 'config' ][ 'api_method' ] ?? $apiMethod; |
|
| 177 | + $rootNodeName = str_replace(".", "_", $apiMethod) . $response_suffix; |
|
| 178 | 178 | |
| 179 | - if (isset($response[$rootNodeName])) { |
|
| 180 | - return $response[$rootNodeName]; |
|
| 181 | - } elseif (isset($response[$error_respones])) { |
|
| 182 | - return $response[$error_respones]; |
|
| 179 | + if (isset($response[ $rootNodeName ])) { |
|
| 180 | + return $response[ $rootNodeName ]; |
|
| 181 | + } elseif (isset($response[ $error_respones ])) { |
|
| 182 | + return $response[ $error_respones ]; |
|
| 183 | 183 | } else { |
| 184 | 184 | return $response; |
| 185 | 185 | } |
@@ -198,11 +198,11 @@ discard block |
||
| 198 | 198 | */ |
| 199 | 199 | public function verify(string $data, $sign, $signType = 'RSA2') |
| 200 | 200 | { |
| 201 | - $alipayPublicKeyPath = $this->app['config']->get('alipay_public_Key_path'); |
|
| 201 | + $alipayPublicKeyPath = $this->app[ 'config' ]->get('alipay_public_Key_path'); |
|
| 202 | 202 | if ($this->checkEmpty($alipayPublicKeyPath)) { |
| 203 | - $pubKey = $this->app['config']->get('alipay_public_Key'); |
|
| 204 | - $pubKey = "-----BEGIN PUBLIC KEY-----\n". |
|
| 205 | - wordwrap($pubKey, 64, "\n", true). |
|
| 203 | + $pubKey = $this->app[ 'config' ]->get('alipay_public_Key'); |
|
| 204 | + $pubKey = "-----BEGIN PUBLIC KEY-----\n" . |
|
| 205 | + wordwrap($pubKey, 64, "\n", true) . |
|
| 206 | 206 | "\n-----END PUBLIC KEY-----"; |
| 207 | 207 | } else { |
| 208 | 208 | // Read public key file |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | $result = $this->verify( |
| 247 | 247 | $content, |
| 248 | 248 | $sign, |
| 249 | - $this->app['config']->get('sign_type', 'RSA2') |
|
| 249 | + $this->app[ 'config' ]->get('sign_type', 'RSA2') |
|
| 250 | 250 | ); |
| 251 | 251 | } else { |
| 252 | 252 | throw new InvalidSignException('check sign Fail! The reason : sign data is Empty', 0, $content); |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | if (!$result) { |
| 256 | 256 | throw new InvalidSignException(sprintf( |
| 257 | 257 | '"%s" method responds to parameter validation signature error', |
| 258 | - $this->app['config']['api_method'] |
|
| 258 | + $this->app[ 'config' ][ 'api_method' ] |
|
| 259 | 259 | )); |
| 260 | 260 | } |
| 261 | 261 | |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | public static function make($name, $config) |
| 37 | 37 | { |
| 38 | 38 | $namespace = Str::studly($name); |
| 39 | - $application = __NAMESPACE__."\\{$namespace}\\Application"; |
|
| 39 | + $application = __NAMESPACE__ . "\\{$namespace}\\Application"; |
|
| 40 | 40 | |
| 41 | 41 | if (class_exists($application)) { |
| 42 | 42 | // Instantiation application |