Completed
Push — master ( 57fe6f...b27f29 )
by wannanbigpig
03:21 queued 10s
created
src/Payment/Kernel/BaseClient.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      * @throws \EasyAlipay\Kernel\Exceptions\InvalidConfigException
60 60
      * @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException
61 61
      */
62
-    public function pageExecute(string $endpoint, array $params = [], string $httpMethod = "POST")
62
+    public function pageExecute(string $endpoint, array $params = [ ], string $httpMethod = "POST")
63 63
     {
64 64
 
65 65
         // Get api system parameters
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
         });
71 71
         $params = array_merge($sysParams, $this->json($params));
72 72
         // Set the signature
73
-        $params['sign'] = $this->generateSign($params, $sysParams['sign_type']);
73
+        $params[ 'sign' ] = $this->generateSign($params, $sysParams[ 'sign_type' ]);
74 74
 
75 75
         if ("GET" === strtoupper($httpMethod)) {
76 76
             // value urlencode
77 77
             $preString = $this->getSignContentUrlencode($params);
78 78
             // Stitching GET request string
79
-            $requestUrl = $this->app->getGateway()."?".$preString;
79
+            $requestUrl = $this->app->getGateway() . "?" . $preString;
80 80
 
81 81
             return $requestUrl;
82 82
         } else {
@@ -96,21 +96,21 @@  discard block
 block discarded – undo
96 96
      */
97 97
     protected function buildRequestForm(array $paraTemp)
98 98
     {
99
-        $sHtml = "<form id='alipaysubmit' name='alipaysubmit' action='".
100
-            $this->app->getGateway()."?charset=".trim($paraTemp['charset']).
99
+        $sHtml = "<form id='alipaysubmit' name='alipaysubmit' action='" .
100
+            $this->app->getGateway() . "?charset=" . trim($paraTemp[ 'charset' ]) .
101 101
             "' method='POST'>";
102 102
 
103 103
         foreach ($paraTemp as $key => $val) {
104 104
             if (false === $this->checkEmpty($val)) {
105 105
                 $val = str_replace("'", "&apos;", $val);
106
-                $sHtml .= "<input type='hidden' name='".$key."' value='".$val."'/>";
106
+                $sHtml .= "<input type='hidden' name='" . $key . "' value='" . $val . "'/>";
107 107
             }
108 108
         }
109 109
 
110 110
         // Submit button control please do not include the name attribute
111
-        $sHtml = $sHtml."<input type='submit' value='ok' style='display:none;''></form>";
111
+        $sHtml = $sHtml . "<input type='submit' value='ok' style='display:none;''></form>";
112 112
 
113
-        $sHtml = $sHtml."<script>document.forms['alipaysubmit'].submit();</script>";
113
+        $sHtml = $sHtml . "<script>document.forms['alipaysubmit'].submit();</script>";
114 114
 
115 115
         return $sHtml;
116 116
     }
Please login to merge, or discard this patch.
src/Kernel/ServiceContainer.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -51,17 +51,17 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         $this->config->set('api_method', $endpoint);
136 136
 
137 137
         return array_merge([
138
-            'app_id' => $this->config['sys_params.app_id'],
138
+            'app_id' => $this->config[ 'sys_params.app_id' ],
139 139
             'method' => $endpoint,
140 140
             'format' => 'JSON',
141 141
             'charset' => $this->config->get('sys_params.charset', 'utf-8'),
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
             'timestamp' => date('Y-m-d H:i:s'),
145 145
             'version' => '1.0',
146 146
             'app_auth_token' => $this->config->get('sys_params.app_auth_token', ''),
147
-        ], $this->config->get($endpoint.'config', []));
147
+        ], $this->config->get($endpoint . 'config', [ ]));
148 148
     }
149 149
 
150 150
     /**
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      */
158 158
     public function setEndpointConfig(string $endpoint, array $config)
159 159
     {
160
-        $this->config->set($endpoint.'config', $config);
160
+        $this->config->set($endpoint . 'config', $config);
161 161
 
162 162
         return $this;
163 163
     }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      */
170 170
     public function getEnv()
171 171
     {
172
-        return isset($this->userConfig['env']) ? $this->userConfig['env'] : self::NORMAL_ENV;
172
+        return isset($this->userConfig[ 'env' ]) ? $this->userConfig[ 'env' ] : self::NORMAL_ENV;
173 173
     }
174 174
 
175 175
     /**
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
      */
182 182
     public function getGateway()
183 183
     {
184
-        if (isset($this->gateway[$this->getEnv()])) {
185
-            return $this->gateway[$this->getEnv()];
184
+        if (isset($this->gateway[ $this->getEnv() ])) {
185
+            return $this->gateway[ $this->getEnv() ];
186 186
         }
187 187
 
188 188
         throw new InvalidConfigException('Invalid environment configuration');
Please login to merge, or discard this patch.
src/Kernel/Support/Support.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     {
46 46
         $this->app = $app;
47 47
 
48
-        $this->setHttpClient($this->app['http_client']);
48
+        $this->setHttpClient($this->app[ 'http_client' ]);
49 49
     }
50 50
 
51 51
     /**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      * @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException
64 64
      * @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException
65 65
      */
66
-    public function request($endpoint, $params = [], $method = 'POST', array $options = [], $returnResponse = false)
66
+    public function request($endpoint, $params = [ ], $method = 'POST', array $options = [ ], $returnResponse = false)
67 67
     {
68 68
         // Get api system parameters
69 69
         $sysParams = $this->app->apiCommonConfig($endpoint);
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         });
74 74
         $params = $this->json($params);
75 75
         // Set the signature
76
-        $sysParams['sign'] = $this->generateSign(array_merge($sysParams, $params), $sysParams['sign_type']);
76
+        $sysParams[ 'sign' ] = $this->generateSign(array_merge($sysParams, $params), $sysParams[ 'sign_type' ]);
77 77
         // Set log middleware to record data, Log request and response data to the log file info level
78 78
         $this->pushMiddleware($this->logMiddleware(), 'log');
79 79
         // Set http parameter options
@@ -81,17 +81,17 @@  discard block
 block discarded – undo
81 81
             'form_params' => $params,
82 82
             'headers' => [
83 83
                 'content-type' => 'application/x-www-form-urlencoded',
84
-                'charset' => $sysParams['charset'],
84
+                'charset' => $sysParams[ 'charset' ],
85 85
             ],
86 86
         ], $options);
87 87
 
88
-        $response = $this->performRequest($method, '?'.http_build_query($sysParams), $options);
88
+        $response = $this->performRequest($method, '?' . http_build_query($sysParams), $options);
89 89
 
90
-        $arrayBody = \GuzzleHttp\json_decode((string)$response->getBody(), true, 512, JSON_BIGINT_AS_STRING);
90
+        $arrayBody = \GuzzleHttp\json_decode((string) $response->getBody(), true, 512, JSON_BIGINT_AS_STRING);
91 91
         $context = \GuzzleHttp\json_encode($this->parserSignSource($arrayBody, $endpoint), JSON_UNESCAPED_UNICODE);
92 92
 
93 93
         // Verify Response Signature
94
-        $this->checkResponseSign($context, $arrayBody['sign'] ?? null);
94
+        $this->checkResponseSign($context, $arrayBody[ 'sign' ] ?? null);
95 95
 
96 96
         return $returnResponse ? $response : $this->handleResponse($response, $context);
97 97
     }
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
     public function handleResponse(ResponseInterface $response, string $context = null)
110 110
     {
111 111
         $is_build = true;
112
-        $response_type = $this->app['config']->get('response_type', 'array');
113
-        $handle_response = $this->app['config']->get('handle_response', true);
112
+        $response_type = $this->app[ 'config' ]->get('response_type', 'array');
113
+        $handle_response = $this->app[ 'config' ]->get('handle_response', true);
114 114
         if ($handle_response && !is_null($context) && $response_type !== 'raw') {
115 115
             $response = new Response(
116 116
                 $response->getStatusCode(),
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
      */
133 133
     protected function logMiddleware()
134 134
     {
135
-        $formatter = new MessageFormatter($this->app['config']['http.log_template'] ?? MessageFormatter::DEBUG);
135
+        $formatter = new MessageFormatter($this->app[ 'config' ][ 'http.log_template' ] ?? MessageFormatter::DEBUG);
136 136
 
137
-        return Middleware::log($this->app['logger']->getLogger(), $formatter);
137
+        return Middleware::log($this->app[ 'logger' ]->getLogger(), $formatter);
138 138
     }
139 139
 
140 140
     /**
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
      */
147 147
     protected function json(array $data): array
148 148
     {
149
-        $array = [];
150
-        if (isset($data['biz_content']) && is_array($data['biz_content'])) {
151
-            $array['biz_content'] = \GuzzleHttp\json_encode($data['biz_content'], JSON_UNESCAPED_UNICODE);
149
+        $array = [ ];
150
+        if (isset($data[ 'biz_content' ]) && is_array($data[ 'biz_content' ])) {
151
+            $array[ 'biz_content' ] = \GuzzleHttp\json_encode($data[ 'biz_content' ], JSON_UNESCAPED_UNICODE);
152 152
         } else {
153 153
             return $data;
154 154
         }
Please login to merge, or discard this patch.