@@ -55,7 +55,7 @@ |
||
55 | 55 | ]), [ |
56 | 56 | 'access_token' => $this->_token, |
57 | 57 | ])); |
58 | - $this->_toArrayCall = function ($result) { |
|
58 | + $this->_toArrayCall = function($result) { |
|
59 | 59 | return I::get($result, 'image'); |
60 | 60 | }; |
61 | 61 |
@@ -84,8 +84,8 @@ |
||
84 | 84 | } |
85 | 85 | return $mixed; |
86 | 86 | } elseif (is_string($mixed) || is_numeric($mixed)) { // 字符串或数字 |
87 | - $pos = (int) $keyString; |
|
88 | - $length = null === $defaultValue ? 1 : (int) $defaultValue; |
|
87 | + $pos = (int)$keyString; |
|
88 | + $length = null === $defaultValue ? 1 : (int)$defaultValue; |
|
89 | 89 | return Strings::sub($mixed, $pos, $length); |
90 | 90 | } elseif (null === $mixed) { // null |
91 | 91 | return $defaultValue; |
@@ -480,6 +480,6 @@ |
||
480 | 480 | public function isVerify($data, $signature, $signType = OPENSSL_ALGO_SHA256) |
481 | 481 | { |
482 | 482 | C::assertNotTrue(null === $this->_pemPublic, '请使用 setPair 提供公钥'); |
483 | - return (boolean) openssl_verify($data, $signature, $this->_pemPublic, $signType); |
|
483 | + return (boolean)openssl_verify($data, $signature, $this->_pemPublic, $signType); |
|
484 | 484 | } |
485 | 485 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | // 接收十六进制(如:0xFF0000和'FF0000')和颜色名字 |
309 | 309 | $hex = I::get(self::$_names, $color, $color); |
310 | 310 | if ($hex) { |
311 | - C::assertNotTrue($hex > 0xFFFFFF || $hex < 0 || hexdec($hex) === 0 && $hex !== '000000' && $hex !== '#000000' , '错误的颜色值:' . $color); |
|
311 | + C::assertNotTrue($hex > 0xFFFFFF || $hex < 0 || hexdec($hex) === 0 && $hex !== '000000' && $hex !== '#000000', '错误的颜色值:' . $color); |
|
312 | 312 | } |
313 | 313 | // 如果是字符形式的十六进制数,则先转成十进制再作后续运算 |
314 | 314 | if (is_string($hex)) { |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | { |
334 | 334 | $type = $this->_type; |
335 | 335 | if (self::TYPE_RGB === $type) { |
336 | - $this->_color = array_map(function ($i) { |
|
336 | + $this->_color = array_map(function($i) { |
|
337 | 337 | return (0.5 + $i) | 0; |
338 | 338 | }, $this->_color); |
339 | 339 | } elseif (self::TYPE_HEX === $type) { |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | { |
387 | 387 | $type = $this->_type; |
388 | 388 | if (self::TYPE_CMYK === $type) { |
389 | - $this->_color = array_map(function ($i) { |
|
389 | + $this->_color = array_map(function($i) { |
|
390 | 390 | return sprintf('%01.4f', $i); |
391 | 391 | }, $this->_color); |
392 | 392 | $this->_type = self::TYPE_CMYK; |
@@ -86,7 +86,7 @@ |
||
86 | 86 | if (Strings::isStartsWith(trim($line), '#')) { |
87 | 87 | continue; |
88 | 88 | } |
89 | - list($name, $value) = Arrays::lists(explode('=', $line), 2, function ($row) { |
|
89 | + list($name, $value) = Arrays::lists(explode('=', $line), 2, function($row) { |
|
90 | 90 | return trim($row); |
91 | 91 | }); |
92 | 92 | $array[$name] = $value; |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public function getCallArray() |
214 | 214 | { |
215 | - C::assertTrue($this->isSuccess(), (string) I::get($this->_result, 'return_msg')); |
|
215 | + C::assertTrue($this->isSuccess(), (string)I::get($this->_result, 'return_msg')); |
|
216 | 216 | $array = []; |
217 | 217 | if ('APP' === I::get($this->_values, 'trade_type')) { |
218 | 218 | $array = [ |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | { |
245 | 245 | $xml = (new Request())->getRawBody(); |
246 | 246 | $array = Xml::toArray($xml); |
247 | - C::assertTrue('SUCCESS' === I::get($array, 'return_code') && 'SUCCESS' === I::get($array, 'result_code'), (string) I::get($array, 'return_msg')); |
|
247 | + C::assertTrue('SUCCESS' === I::get($array, 'return_code') && 'SUCCESS' === I::get($array, 'result_code'), (string)I::get($array, 'return_msg')); |
|
248 | 248 | $temp = $array; |
249 | 249 | $sign = $temp['sign']; |
250 | 250 | unset($temp['sign']); |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | */ |
480 | 480 | public function shortUrl() |
481 | 481 | { |
482 | - C::assertTrue(null !== ($longUrl = (string) I::get($this->_values, 'long_url')), '缺少 long_url 参数!'); |
|
482 | + C::assertTrue(null !== ($longUrl = (string)I::get($this->_values, 'long_url')), '缺少 long_url 参数!'); |
|
483 | 483 | $values = array_filter([ |
484 | 484 | 'appid' => $this->_appId, |
485 | 485 | 'mch_id' => $this->_mchId, |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | */ |
505 | 505 | public function getQrcodeUrl() |
506 | 506 | { |
507 | - C::assertTrue(null !== ($productId = (string) I::get($this->_values, 'product_id')), '缺少 product_id 参数!'); |
|
507 | + C::assertTrue(null !== ($productId = (string)I::get($this->_values, 'product_id')), '缺少 product_id 参数!'); |
|
508 | 508 | $values = [ |
509 | 509 | 'appid' => $this->_appId, |
510 | 510 | 'mch_id' => $this->_mchId, |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | 'charset' => 'UTF-8', |
76 | 76 | ])); |
77 | 77 | |
78 | - $this->_toArrayCall = function ($result) { |
|
79 | - return Arrays::column((array) I::get($result, 'items', []), 'item'); |
|
78 | + $this->_toArrayCall = function($result) { |
|
79 | + return Arrays::column((array)I::get($result, 'items', []), 'item'); |
|
80 | 80 | }; |
81 | 81 | |
82 | 82 | return $this; |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | 'access_token' => $this->_token, |
104 | 104 | 'charset' => 'UTF-8', |
105 | 105 | ])); |
106 | - $this->_toArrayCall = function ($result) { |
|
107 | - return Arrays::column((array) I::get($result, 'items', []), 'word'); |
|
106 | + $this->_toArrayCall = function($result) { |
|
107 | + return Arrays::column((array)I::get($result, 'items', []), 'word'); |
|
108 | 108 | }; |
109 | 109 | |
110 | 110 | return $this; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | 'access_token' => $this->_token, |
135 | 135 | 'charset' => 'UTF-8', |
136 | 136 | ])); |
137 | - $this->_toArrayCall = function ($result) { |
|
137 | + $this->_toArrayCall = function($result) { |
|
138 | 138 | return I::get($result, 'score'); |
139 | 139 | }; |
140 | 140 |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | } catch (ClientException $e) { |
158 | 158 | throw new Exception("access_token 获取失败,接口返回为:" . $e->getResponse()->getBody()->getContents()); |
159 | 159 | } |
160 | - $this->_token = (string) $this->getResult(self::RESULT_TOKEN); |
|
160 | + $this->_token = (string)$this->getResult(self::RESULT_TOKEN); |
|
161 | 161 | } |
162 | 162 | return $this; |
163 | 163 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | */ |
183 | 183 | public function getError() |
184 | 184 | { |
185 | - return (string) I::get($this->_errorMap, I::get($this->_result, 'error_code', 0), '未知错误'); |
|
185 | + return (string)I::get($this->_errorMap, I::get($this->_result, 'error_code', 0), '未知错误'); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function toArray() |
227 | 227 | { |
228 | - return (array) I::call($this->_toArrayCall, [$this->getResult()]); |
|
228 | + return (array)I::call($this->_toArrayCall, [$this->getResult()]); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | ]), [ |
77 | 77 | 'access_token' => $this->_token, |
78 | 78 | ])); |
79 | - $this->_toArrayCall = function ($result) { |
|
80 | - return Arrays::column((array) I::get($result, 'words_result', []), 'words'); |
|
79 | + $this->_toArrayCall = function($result) { |
|
80 | + return Arrays::column((array)I::get($result, 'words_result', []), 'words'); |
|
81 | 81 | }; |
82 | 82 | |
83 | 83 | return $this; |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | ]), [ |
103 | 103 | 'access_token' => $this->_token, |
104 | 104 | ])); |
105 | - $this->_toArrayCall = function ($result) { |
|
106 | - return Arrays::column((array) I::get($result, 'words_result', []), 'words'); |
|
105 | + $this->_toArrayCall = function($result) { |
|
106 | + return Arrays::column((array)I::get($result, 'words_result', []), 'words'); |
|
107 | 107 | }; |
108 | 108 | |
109 | 109 | return $this; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | ]), [ |
133 | 133 | 'access_token' => $this->_token, |
134 | 134 | ])); |
135 | - $this->_toArrayCall = function ($result) { |
|
135 | + $this->_toArrayCall = function($result) { |
|
136 | 136 | return I::get($result, 'words_result'); |
137 | 137 | }; |
138 | 138 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | ]), [ |
161 | 161 | 'access_token' => $this->_token, |
162 | 162 | ])); |
163 | - $this->_toArrayCall = function ($result) { |
|
163 | + $this->_toArrayCall = function($result) { |
|
164 | 164 | return I::get($result, 'words_result'); |
165 | 165 | }; |
166 | 166 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | ]), [ |
187 | 187 | 'access_token' => $this->_token, |
188 | 188 | ])); |
189 | - $this->_toArrayCall = function ($result) { |
|
189 | + $this->_toArrayCall = function($result) { |
|
190 | 190 | return I::get($result, 'words_result'); |
191 | 191 | }; |
192 | 192 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $this->_result = Json::decode(Http::post('https://aip.baidubce.com/rest/2.0/ocr/v1/idcard', $options, [ |
215 | 215 | 'access_token' => $this->_token, |
216 | 216 | ])); |
217 | - $this->_toArrayCall = function ($result) { |
|
217 | + $this->_toArrayCall = function($result) { |
|
218 | 218 | $return = []; |
219 | 219 | $words = I::get($result, 'words_result', []); |
220 | 220 | foreach ($words as $name => $word) { |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $this->_result = Json::decode(Http::post('https://aip.baidubce.com/rest/2.0/ocr/v1/bankcard', $options, [ |
241 | 241 | 'access_token' => $this->_token, |
242 | 242 | ])); |
243 | - $this->_toArrayCall = function ($result) { |
|
243 | + $this->_toArrayCall = function($result) { |
|
244 | 244 | return I::get($result, 'result'); |
245 | 245 | }; |
246 | 246 | return $this; |