@@ -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 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | if (null === $returnUrl) { |
| 28 | 28 | $url = $object->url; |
| 29 | 29 | } else { |
| 30 | - $url = $object->url . '&redirect_url=' . urlencode($returnUrl); |
|
| 30 | + $url = $object->url.'&redirect_url='.urlencode($returnUrl); |
|
| 31 | 31 | } |
| 32 | 32 | echo $url; |
| 33 | 33 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | ksort($array); |
| 31 | - $string = md5(self::getSignContent($array) . '&key=' . $key); |
|
| 31 | + $string = md5(self::getSignContent($array).'&key='.$key); |
|
| 32 | 32 | $string = strtoupper($string); |
| 33 | 33 | |
| 34 | 34 | return $string; |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | $string = ''; |
| 47 | 47 | foreach ($array as $key => $val) { |
| 48 | - if ($key !== 'sign' && $val !== '' && ! \is_array($val)) { |
|
| 49 | - $string .= $key . '=' . $val; |
|
| 48 | + if ($key !== 'sign' && $val !== '' && !\is_array($val)) { |
|
| 49 | + $string .= $key.'='.$val; |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $data = []; |
| 115 | 115 | foreach ($array as $key => $val) { |
| 116 | 116 | if (\is_array($val)) { |
| 117 | - $data[$key] = self::toEncoding((array)$val, $to, $from); |
|
| 117 | + $data[$key] = self::toEncoding((array) $val, $to, $from); |
|
| 118 | 118 | } else { |
| 119 | 119 | $data[$key] = mb_convert_encoding($val, $to, $from); |
| 120 | 120 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | if ($code !== 'SUCCESS') { |
| 39 | 39 | throw new GatewayException( |
| 40 | - 'Wechat API Error: ' . $result['return_msg'], |
|
| 40 | + 'Wechat API Error: '.$result['return_msg'], |
|
| 41 | 41 | 20000 |
| 42 | 42 | ); |
| 43 | 43 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public static function toXml(array $array) : string |
| 119 | 119 | { |
| 120 | - if (! $array) { |
|
| 120 | + if (!$array) { |
|
| 121 | 121 | throw new \InvalidArgumentException('Invalid [array] argument.', 2); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public static function fromXml(string $xml) : array |
| 144 | 144 | { |
| 145 | - if (! $xml) { |
|
| 145 | + if (!$xml) { |
|
| 146 | 146 | throw new \InvalidArgumentException('Invalid [xml] argument.', 3); |
| 147 | 147 | } |
| 148 | 148 | libxml_disable_entity_loader(true); |