@@ -93,7 +93,7 @@ |
||
| 93 | 93 | public function pay(string $gateway, array $array = []) |
| 94 | 94 | { |
| 95 | 95 | $this->payload['biz_content'] = $array; |
| 96 | - $class = \get_class($this) . '\\' . Str::studly($gateway) . 'Payment'; |
|
| 96 | + $class = \get_class($this).'\\'.Str::studly($gateway).'Payment'; |
|
| 97 | 97 | |
| 98 | 98 | if (class_exists($class)) { |
| 99 | 99 | return $this->toPay($class); |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | protected function create(string $method) |
| 44 | 44 | { |
| 45 | - $class = __NAMESPACE__ . '\\' . Str::studly($method); |
|
| 45 | + $class = __NAMESPACE__.'\\'.Str::studly($method); |
|
| 46 | 46 | if (class_exists($class)) { |
| 47 | 47 | return $this->make($class); |
| 48 | 48 | } |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | protected static function getLoggerInstance() : Logger |
| 81 | 81 | { |
| 82 | 82 | $maxFiles = 7; |
| 83 | - $filename = sys_get_temp_dir() . '/logs/pay.log'; |
|
| 83 | + $filename = sys_get_temp_dir().'/logs/pay.log'; |
|
| 84 | 84 | $handler = new RotatingFileHandler($filename, $maxFiles); |
| 85 | 85 | $handler->setFilenameFormat('{date}-{filename}', 'Y-m-d'); |
| 86 | 86 | $formatter = new LineFormatter(null, null, true, true); |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | { |
| 24 | 24 | $required = ['out_trade_no', 'total_amount', 'subject']; |
| 25 | 25 | foreach ($required as $key => $item) { |
| 26 | - if (! array_key_exists($item, $order)) { |
|
| 26 | + if (!array_key_exists($item, $order)) { |
|
| 27 | 27 | throw new \InvalidArgumentException("The {$item} field is required"); |
| 28 | 28 | } |
| 29 | 29 | } |
@@ -27,14 +27,14 @@ |
||
| 27 | 27 | public function send(array $array, string $key) : Collection |
| 28 | 28 | { |
| 29 | 29 | $method = Arr::get($array, 'method'); |
| 30 | - $method = str_replace('.', '_', $method) . '_response'; |
|
| 30 | + $method = str_replace('.', '_', $method).'_response'; |
|
| 31 | 31 | $result = $this->post('', $array); |
| 32 | 32 | $result = mb_convert_encoding($result, 'UTF-8', 'GB2312'); |
| 33 | 33 | $result = json_decode($result, true); |
| 34 | 34 | |
| 35 | 35 | $data = Arr::get($result, $method); |
| 36 | 36 | $sign = Arr::get($result, 'sign'); |
| 37 | - if (! self::verifySign($data, $key, true, $sign)) { |
|
| 37 | + if (!self::verifySign($data, $key, true, $sign)) { |
|
| 38 | 38 | throw new InvalidSignException( |
| 39 | 39 | 'Invalid Alipay [signature] verify.', |
| 40 | 40 | 3 |
@@ -58,15 +58,15 @@ discard block |
||
| 58 | 58 | $string = ''; |
| 59 | 59 | foreach ($array as $key => $val) { |
| 60 | 60 | if ($isVerify && $key !== 'sign' && $key !== 'sign_type') { |
| 61 | - $string .= $key . '=' . $val . '&'; |
|
| 61 | + $string .= $key.'='.$val.'&'; |
|
| 62 | 62 | } |
| 63 | - if (! $isVerify |
|
| 63 | + if (!$isVerify |
|
| 64 | 64 | && $val !== '' |
| 65 | 65 | && null !== $val |
| 66 | 66 | && $key !== 'sign' |
| 67 | 67 | && 0 !== strpos($val, '@') |
| 68 | 68 | ) { |
| 69 | - $string .= $key . '=' . $val . '&'; |
|
| 69 | + $string .= $key.'='.$val.'&'; |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $data = []; |
| 135 | 135 | foreach ($array as $key => $val) { |
| 136 | 136 | if (\is_array($val)) { |
| 137 | - $data[$key] = self::toEncoding((array)$val, $to, $from); |
|
| 137 | + $data[$key] = self::toEncoding((array) $val, $to, $from); |
|
| 138 | 138 | } else { |
| 139 | 139 | $data[$key] = mb_convert_encoding($val, $to, $from); |
| 140 | 140 | } |