@@ -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; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public static function toBytes($size) |
| 81 | 81 | { |
| 82 | - $callback = function ($matches) { |
|
| 82 | + $callback = function($matches) { |
|
| 83 | 83 | $sizeMap = [ |
| 84 | 84 | '' => 0, |
| 85 | 85 | 'b' => 0, // 为了简化正则 |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | return $matches[1] * pow(1024, $sizeMap[strtolower($matches[2])]); |
| 94 | 94 | }; |
| 95 | 95 | |
| 96 | - return (int) preg_replace_callback('/(\d*)\s*([a-z]?)b?/i', $callback, $size, 1); |
|
| 96 | + return (int)preg_replace_callback('/(\d*)\s*([a-z]?)b?/i', $callback, $size, 1); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | if ($toBaseInput == '0123456789') { |
| 157 | 157 | $retval = 0; |
| 158 | 158 | for ($i = 1; $i <= $numberLen; $i++) { |
| 159 | - $retval = bcadd($retval, bcmul((string) array_search($number[$i - 1], $fromBase), bcpow($fromLen, $numberLen - $i))); |
|
| 159 | + $retval = bcadd($retval, bcmul((string)array_search($number[$i - 1], $fromBase), bcpow($fromLen, $numberLen - $i))); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | return $retval; |
@@ -166,8 +166,4 @@ |
||
| 166 | 166 | $local->putFileContent($file, <<<EOT |
| 167 | 167 | <?php |
| 168 | 168 | |
| 169 | -return {$array}; |
|
| 170 | - |
|
| 171 | -EOT); |
|
| 172 | - } |
|
| 173 | -} |
|
| 169 | +return {$array} |
|
| 174 | 170 | \ No newline at end of file |
@@ -166,8 +166,4 @@ |
||
| 166 | 166 | $local->putFileContent($file, <<<EOT |
| 167 | 167 | <?php |
| 168 | 168 | |
| 169 | -return {$array}; |
|
| 170 | - |
|
| 171 | -EOT); |
|
| 172 | - } |
|
| 173 | -} |
|
| 169 | +return {$array} |
|
| 174 | 170 | \ No newline at end of file |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | 'page' => $page, |
| 31 | 31 | 'pageSize' => $pageSize, |
| 32 | 32 | ]), 'data', []); |
| 33 | - $this->_toArrayCall = function ($array) { |
|
| 33 | + $this->_toArrayCall = function($array) { |
|
| 34 | 34 | return Arrays::columns($array, [ |
| 35 | 35 | 'id' => 'd_id', |
| 36 | 36 | 'name' => 'd_name', |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | 'page' => $page, |
| 59 | 59 | 'pageSize' => $pageSize, |
| 60 | 60 | ]), 'data', []); |
| 61 | - $this->_toArrayCall = function ($array) { |
|
| 61 | + $this->_toArrayCall = function($array) { |
|
| 62 | 62 | return Arrays::columns($array, [ |
| 63 | 63 | 'id' => 'd_id', |
| 64 | 64 | 'name' => 'd_name', |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $this->_result = (array)Json::get(Http::get('http://api.jinsapi.com/yingshi/getVodById', [ |
| 83 | 83 | 'd_id' => $id, |
| 84 | 84 | ]), 'data', []); |
| 85 | - $this->_toArrayCall = function ($array) { |
|
| 85 | + $this->_toArrayCall = function($array) { |
|
| 86 | 86 | return Arrays::columns($array, [ |
| 87 | 87 | 'id' => 'd_id', |
| 88 | 88 | 'name' => 'd_name', |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | public function fetchCitys($provinceCode = null) |
| 38 | 38 | { |
| 39 | 39 | $this->_result = (array)Json::decode(Http::get('http://www.nmc.cn/f/rest/province/' . $provinceCode)); |
| 40 | - $this->_toArrayCall = function ($array) { |
|
| 40 | + $this->_toArrayCall = function($array) { |
|
| 41 | 41 | return Arrays::columns($array, ['code', 'city', 'province']); |
| 42 | 42 | }; |
| 43 | 43 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | public function fetchWeather($cityId) |
| 71 | 71 | { |
| 72 | 72 | $this->_result = (array)Json::decode(Http::get('http://www.nmc.cn/f/rest/real/' . $cityId)); |
| 73 | - $this->_toArrayCall = function ($array) { |
|
| 73 | + $this->_toArrayCall = function($array) { |
|
| 74 | 74 | return Arrays::columns($array, [ |
| 75 | 75 | 'publish_time', |
| 76 | 76 | 'airpressure' => 'weather.airpressure', |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | public function fetchAirQuality($cityId) |
| 105 | 105 | { |
| 106 | 106 | $this->_result = (array)Json::decode(Http::get('http://www.nmc.cn/f/rest/aqi/' . $cityId)); |
| 107 | - $this->_toArrayCall = function ($array) { |
|
| 107 | + $this->_toArrayCall = function($array) { |
|
| 108 | 108 | return Arrays::columns($array, [ |
| 109 | 109 | 'forecasttime', |
| 110 | 110 | 'aq', |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | * |
| 130 | 130 | * @return static |
| 131 | 131 | */ |
| 132 | - public function fetchToday($cityId){ |
|
| 132 | + public function fetchToday($cityId) { |
|
| 133 | 133 | $this->_result = (array)Json::decode(Http::get('http://www.nmc.cn/f/rest/passed/' . $cityId)); |
| 134 | - $this->_toArrayCall = function ($array) { |
|
| 134 | + $this->_toArrayCall = function($array) { |
|
| 135 | 135 | return Arrays::columns($array, [ |
| 136 | 136 | 'time', |
| 137 | 137 | 'humidity', |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | if (is_array($error)) { |
| 68 | 68 | return $error; |
| 69 | 69 | } |
| 70 | - throw new Exception((string) $error); |
|
| 70 | + throw new Exception((string)$error); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function toArray() |
| 88 | 88 | { |
| 89 | - return (array) I::call($this->_toArrayCall, [$this->getResult()]); |
|
| 89 | + return (array)I::call($this->_toArrayCall, [$this->getResult()]); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | public function generalBasic() |
| 85 | 85 | { |
| 86 | 86 | $this->requestToken(); |
| 87 | - $this->_result = (array) Json::decode(Http::post(self::URL_GENERAL_BASIC, parent::filterOptions([ |
|
| 87 | + $this->_result = (array)Json::decode(Http::post(self::URL_GENERAL_BASIC, parent::filterOptions([ |
|
| 88 | 88 | 'image', |
| 89 | 89 | 'language_type', |
| 90 | 90 | 'detect_direction', |
@@ -94,8 +94,8 @@ discard block |
||
| 94 | 94 | ]), [ |
| 95 | 95 | 'access_token' => $this->_token, |
| 96 | 96 | ])); |
| 97 | - $this->_toArrayCall = function ($result) { |
|
| 98 | - return Arrays::column((array) I::get($result, 'words_result', []), 'words'); |
|
| 97 | + $this->_toArrayCall = function($result) { |
|
| 98 | + return Arrays::column((array)I::get($result, 'words_result', []), 'words'); |
|
| 99 | 99 | }; |
| 100 | 100 | |
| 101 | 101 | return $this; |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | public function accurateBasic() |
| 118 | 118 | { |
| 119 | 119 | $this->requestToken(); |
| 120 | - $this->_result = (array) Json::decode(Http::post(self::URL_ACCURATE_BASIC, parent::filterOptions([ |
|
| 120 | + $this->_result = (array)Json::decode(Http::post(self::URL_ACCURATE_BASIC, parent::filterOptions([ |
|
| 121 | 121 | 'image', |
| 122 | 122 | 'language_type', |
| 123 | 123 | 'detect_direction', |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | ]), [ |
| 127 | 127 | 'access_token' => $this->_token, |
| 128 | 128 | ])); |
| 129 | - $this->_toArrayCall = function ($result) { |
|
| 130 | - return Arrays::column((array) I::get($result, 'words_result', []), 'words'); |
|
| 129 | + $this->_toArrayCall = function($result) { |
|
| 130 | + return Arrays::column((array)I::get($result, 'words_result', []), 'words'); |
|
| 131 | 131 | }; |
| 132 | 132 | |
| 133 | 133 | return $this; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | public function general() |
| 150 | 150 | { |
| 151 | 151 | $this->requestToken(); |
| 152 | - $this->_result = (array) Json::decode(Http::post(self::URL_GENERAL, parent::filterOptions([ |
|
| 152 | + $this->_result = (array)Json::decode(Http::post(self::URL_GENERAL, parent::filterOptions([ |
|
| 153 | 153 | 'image', |
| 154 | 154 | 'recognize_granularity', |
| 155 | 155 | 'language_type', |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | ]), [ |
| 162 | 162 | 'access_token' => $this->_token, |
| 163 | 163 | ])); |
| 164 | - $this->_toArrayCall = function ($result) { |
|
| 164 | + $this->_toArrayCall = function($result) { |
|
| 165 | 165 | return I::get($result, 'words_result'); |
| 166 | 166 | }; |
| 167 | 167 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | public function accurate() |
| 185 | 185 | { |
| 186 | 186 | $this->requestToken(); |
| 187 | - $this->_result = (array) Json::decode(Http::post(self::URL_ACCURATE, parent::filterOptions([ |
|
| 187 | + $this->_result = (array)Json::decode(Http::post(self::URL_ACCURATE, parent::filterOptions([ |
|
| 188 | 188 | 'image', |
| 189 | 189 | 'language_type', |
| 190 | 190 | 'recognize_granularity', |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | ]), [ |
| 196 | 196 | 'access_token' => $this->_token, |
| 197 | 197 | ])); |
| 198 | - $this->_toArrayCall = function ($result) { |
|
| 198 | + $this->_toArrayCall = function($result) { |
|
| 199 | 199 | return I::get($result, 'words_result'); |
| 200 | 200 | }; |
| 201 | 201 | |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | { |
| 222 | 222 | parent::setOption('id_card_side', $side); |
| 223 | 223 | $this->requestToken(); |
| 224 | - $this->_result = (array) Json::decode(Http::post(self::URL_ID_CARD, parent::filterOptions([ |
|
| 224 | + $this->_result = (array)Json::decode(Http::post(self::URL_ID_CARD, parent::filterOptions([ |
|
| 225 | 225 | 'image', |
| 226 | 226 | 'id_card_side', |
| 227 | 227 | 'detect_direction', |
@@ -231,8 +231,8 @@ discard block |
||
| 231 | 231 | ]), [ |
| 232 | 232 | 'access_token' => $this->_token, |
| 233 | 233 | ])); |
| 234 | - $this->_toArrayCall = function ($result) { |
|
| 235 | - return Arrays::column((array) I::get($result, 'words_result', []), 'words'); |
|
| 234 | + $this->_toArrayCall = function($result) { |
|
| 235 | + return Arrays::column((array)I::get($result, 'words_result', []), 'words'); |
|
| 236 | 236 | }; |
| 237 | 237 | |
| 238 | 238 | return $this; |
@@ -254,12 +254,12 @@ discard block |
||
| 254 | 254 | public function bankcard() |
| 255 | 255 | { |
| 256 | 256 | $this->requestToken(); |
| 257 | - $this->_result = (array) Json::decode(Http::post(self::URL_BANK_CARD, parent::filterOptions([ |
|
| 257 | + $this->_result = (array)Json::decode(Http::post(self::URL_BANK_CARD, parent::filterOptions([ |
|
| 258 | 258 | 'image', |
| 259 | 259 | ]), [ |
| 260 | 260 | 'access_token' => $this->_token, |
| 261 | 261 | ])); |
| 262 | - $this->_toArrayCall = function ($result) { |
|
| 262 | + $this->_toArrayCall = function($result) { |
|
| 263 | 263 | return I::get($result, 'result'); |
| 264 | 264 | }; |
| 265 | 265 | return $this; |
@@ -281,15 +281,15 @@ discard block |
||
| 281 | 281 | public function businessLicense() |
| 282 | 282 | { |
| 283 | 283 | $this->requestToken(); |
| 284 | - $this->_result = (array) Json::decode(Http::post(self::URL_BUSINESS_LICENSE, parent::filterOptions([ |
|
| 284 | + $this->_result = (array)Json::decode(Http::post(self::URL_BUSINESS_LICENSE, parent::filterOptions([ |
|
| 285 | 285 | 'image', |
| 286 | 286 | 'detect_direction', |
| 287 | 287 | 'accuracy', |
| 288 | 288 | ]), [ |
| 289 | 289 | 'access_token' => $this->_token, |
| 290 | 290 | ])); |
| 291 | - $this->_toArrayCall = function ($result) { |
|
| 292 | - return Arrays::column((array) I::get($result, 'words_result', []), 'words'); |
|
| 291 | + $this->_toArrayCall = function($result) { |
|
| 292 | + return Arrays::column((array)I::get($result, 'words_result', []), 'words'); |
|
| 293 | 293 | }; |
| 294 | 294 | |
| 295 | 295 | return $this; |
@@ -311,12 +311,12 @@ discard block |
||
| 311 | 311 | public function businessCard() |
| 312 | 312 | { |
| 313 | 313 | $this->requestToken(); |
| 314 | - $this->_result = (array) Json::decode(Http::post(self::URL_BUSINESS_CARD, parent::filterOptions([ |
|
| 314 | + $this->_result = (array)Json::decode(Http::post(self::URL_BUSINESS_CARD, parent::filterOptions([ |
|
| 315 | 315 | 'image', |
| 316 | 316 | ]), [ |
| 317 | 317 | 'access_token' => $this->_token, |
| 318 | 318 | ])); |
| 319 | - $this->_toArrayCall = function ($result) { |
|
| 319 | + $this->_toArrayCall = function($result) { |
|
| 320 | 320 | return I::get($result, 'words_result'); |
| 321 | 321 | }; |
| 322 | 322 | |
@@ -339,13 +339,13 @@ discard block |
||
| 339 | 339 | public function passport() |
| 340 | 340 | { |
| 341 | 341 | $this->requestToken(); |
| 342 | - $this->_result = (array) Json::decode(Http::post(self::URL_PASSPORT, parent::filterOptions([ |
|
| 342 | + $this->_result = (array)Json::decode(Http::post(self::URL_PASSPORT, parent::filterOptions([ |
|
| 343 | 343 | 'image', |
| 344 | 344 | ]), [ |
| 345 | 345 | 'access_token' => $this->_token, |
| 346 | 346 | ])); |
| 347 | - $this->_toArrayCall = function ($result) { |
|
| 348 | - return Arrays::column((array) I::get($result, 'words_result', []), 'words'); |
|
| 347 | + $this->_toArrayCall = function($result) { |
|
| 348 | + return Arrays::column((array)I::get($result, 'words_result', []), 'words'); |
|
| 349 | 349 | }; |
| 350 | 350 | |
| 351 | 351 | return $this; |
@@ -367,13 +367,13 @@ discard block |
||
| 367 | 367 | public function hkMacauExitentrypermit() |
| 368 | 368 | { |
| 369 | 369 | $this->requestToken(); |
| 370 | - $this->_result = (array) Json::decode(Http::post(self::URL_HK_MACAU_EXITENTRYPERMIT, parent::filterOptions([ |
|
| 370 | + $this->_result = (array)Json::decode(Http::post(self::URL_HK_MACAU_EXITENTRYPERMIT, parent::filterOptions([ |
|
| 371 | 371 | 'image', |
| 372 | 372 | ]), [ |
| 373 | 373 | 'access_token' => $this->_token, |
| 374 | 374 | ])); |
| 375 | - $this->_toArrayCall = function ($result) { |
|
| 376 | - return Arrays::column((array) I::get($result, 'words_result', []), 'words'); |
|
| 375 | + $this->_toArrayCall = function($result) { |
|
| 376 | + return Arrays::column((array)I::get($result, 'words_result', []), 'words'); |
|
| 377 | 377 | }; |
| 378 | 378 | |
| 379 | 379 | return $this; |
@@ -395,13 +395,13 @@ discard block |
||
| 395 | 395 | public function taiwanExitentrypermit() |
| 396 | 396 | { |
| 397 | 397 | $this->requestToken(); |
| 398 | - $this->_result = (array) Json::decode(Http::post(self::URL_TAIWAN_EXITENTRYPERMIT, parent::filterOptions([ |
|
| 398 | + $this->_result = (array)Json::decode(Http::post(self::URL_TAIWAN_EXITENTRYPERMIT, parent::filterOptions([ |
|
| 399 | 399 | 'image', |
| 400 | 400 | ]), [ |
| 401 | 401 | 'access_token' => $this->_token, |
| 402 | 402 | ])); |
| 403 | - $this->_toArrayCall = function ($result) { |
|
| 404 | - return Arrays::column((array) I::get($result, 'words_result', []), 'words'); |
|
| 403 | + $this->_toArrayCall = function($result) { |
|
| 404 | + return Arrays::column((array)I::get($result, 'words_result', []), 'words'); |
|
| 405 | 405 | }; |
| 406 | 406 | |
| 407 | 407 | return $this; |
@@ -423,13 +423,13 @@ discard block |
||
| 423 | 423 | public function householdRegister() |
| 424 | 424 | { |
| 425 | 425 | $this->requestToken(); |
| 426 | - $this->_result = (array) Json::decode(Http::post(self::URL_HOUSEHOLD_REGISTER, parent::filterOptions([ |
|
| 426 | + $this->_result = (array)Json::decode(Http::post(self::URL_HOUSEHOLD_REGISTER, parent::filterOptions([ |
|
| 427 | 427 | 'image', |
| 428 | 428 | ]), [ |
| 429 | 429 | 'access_token' => $this->_token, |
| 430 | 430 | ])); |
| 431 | - $this->_toArrayCall = function ($result) { |
|
| 432 | - return Arrays::column((array) I::get($result, 'words_result', []), 'words'); |
|
| 431 | + $this->_toArrayCall = function($result) { |
|
| 432 | + return Arrays::column((array)I::get($result, 'words_result', []), 'words'); |
|
| 433 | 433 | }; |
| 434 | 434 | |
| 435 | 435 | return $this; |
@@ -451,13 +451,13 @@ discard block |
||
| 451 | 451 | public function birthCertificate() |
| 452 | 452 | { |
| 453 | 453 | $this->requestToken(); |
| 454 | - $this->_result = (array) Json::decode(Http::post(self::URL_BIRTH_CERTIFICATE, parent::filterOptions([ |
|
| 454 | + $this->_result = (array)Json::decode(Http::post(self::URL_BIRTH_CERTIFICATE, parent::filterOptions([ |
|
| 455 | 455 | 'image', |
| 456 | 456 | ]), [ |
| 457 | 457 | 'access_token' => $this->_token, |
| 458 | 458 | ])); |
| 459 | - $this->_toArrayCall = function ($result) { |
|
| 460 | - return Arrays::column((array) I::get($result, 'words_result', []), 'words'); |
|
| 459 | + $this->_toArrayCall = function($result) { |
|
| 460 | + return Arrays::column((array)I::get($result, 'words_result', []), 'words'); |
|
| 461 | 461 | }; |
| 462 | 462 | |
| 463 | 463 | return $this; |
@@ -481,14 +481,14 @@ discard block |
||
| 481 | 481 | public function vatInvoice() |
| 482 | 482 | { |
| 483 | 483 | $this->requestToken(); |
| 484 | - $this->_result = (array) Json::decode(Http::post(self::URL_VAT_INVOICE, parent::filterOptions([ |
|
| 484 | + $this->_result = (array)Json::decode(Http::post(self::URL_VAT_INVOICE, parent::filterOptions([ |
|
| 485 | 485 | 'image', |
| 486 | 486 | 'accuracy', |
| 487 | 487 | 'type', |
| 488 | 488 | ]), [ |
| 489 | 489 | 'access_token' => $this->_token, |
| 490 | 490 | ])); |
| 491 | - $this->_toArrayCall = function ($result) { |
|
| 491 | + $this->_toArrayCall = function($result) { |
|
| 492 | 492 | return I::get($result, 'words_result', []); |
| 493 | 493 | }; |
| 494 | 494 | |
@@ -511,12 +511,12 @@ discard block |
||
| 511 | 511 | public function quotaInvoice() |
| 512 | 512 | { |
| 513 | 513 | $this->requestToken(); |
| 514 | - $this->_result = (array) Json::decode(Http::post(self::URL_QUOTA_INVOICE, parent::filterOptions([ |
|
| 514 | + $this->_result = (array)Json::decode(Http::post(self::URL_QUOTA_INVOICE, parent::filterOptions([ |
|
| 515 | 515 | 'image', |
| 516 | 516 | ]), [ |
| 517 | 517 | 'access_token' => $this->_token, |
| 518 | 518 | ])); |
| 519 | - $this->_toArrayCall = function ($result) { |
|
| 519 | + $this->_toArrayCall = function($result) { |
|
| 520 | 520 | return I::get($result, 'words_result', []); |
| 521 | 521 | }; |
| 522 | 522 | |
@@ -539,12 +539,12 @@ discard block |
||
| 539 | 539 | public function trainTicket() |
| 540 | 540 | { |
| 541 | 541 | $this->requestToken(); |
| 542 | - $this->_result = (array) Json::decode(Http::post(self::URL_TRAIN_TICKET, parent::filterOptions([ |
|
| 542 | + $this->_result = (array)Json::decode(Http::post(self::URL_TRAIN_TICKET, parent::filterOptions([ |
|
| 543 | 543 | 'image', |
| 544 | 544 | ]), [ |
| 545 | 545 | 'access_token' => $this->_token, |
| 546 | 546 | ])); |
| 547 | - $this->_toArrayCall = function ($result) { |
|
| 547 | + $this->_toArrayCall = function($result) { |
|
| 548 | 548 | return I::get($result, '0', []); |
| 549 | 549 | }; |
| 550 | 550 | |
@@ -567,12 +567,12 @@ discard block |
||
| 567 | 567 | public function taxiReceipt() |
| 568 | 568 | { |
| 569 | 569 | $this->requestToken(); |
| 570 | - $this->_result = (array) Json::decode(Http::post(self::URL_TAXI_RECEIPT, parent::filterOptions([ |
|
| 570 | + $this->_result = (array)Json::decode(Http::post(self::URL_TAXI_RECEIPT, parent::filterOptions([ |
|
| 571 | 571 | 'image', |
| 572 | 572 | ]), [ |
| 573 | 573 | 'access_token' => $this->_token, |
| 574 | 574 | ])); |
| 575 | - $this->_toArrayCall = function ($result) { |
|
| 575 | + $this->_toArrayCall = function($result) { |
|
| 576 | 576 | return I::get($result, 'words_result', []); |
| 577 | 577 | }; |
| 578 | 578 | |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | public function receipt() |
| 596 | 596 | { |
| 597 | 597 | $this->requestToken(); |
| 598 | - $this->_result = (array) Json::decode(Http::post(self::URL_RECEIPT, parent::filterOptions([ |
|
| 598 | + $this->_result = (array)Json::decode(Http::post(self::URL_RECEIPT, parent::filterOptions([ |
|
| 599 | 599 | 'image', |
| 600 | 600 | 'recognize_granularity', |
| 601 | 601 | 'probability', |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | ]), [ |
| 605 | 605 | 'access_token' => $this->_token, |
| 606 | 606 | ])); |
| 607 | - $this->_toArrayCall = function ($result) { |
|
| 607 | + $this->_toArrayCall = function($result) { |
|
| 608 | 608 | return I::get($result, 'words_result', []); |
| 609 | 609 | }; |
| 610 | 610 | |
@@ -627,13 +627,13 @@ discard block |
||
| 627 | 627 | public function insuranceDocuments() |
| 628 | 628 | { |
| 629 | 629 | $this->requestToken(); |
| 630 | - $this->_result = (array) Json::decode(Http::post(self::URL_INSURANCE_DOCUMENTS, parent::filterOptions([ |
|
| 630 | + $this->_result = (array)Json::decode(Http::post(self::URL_INSURANCE_DOCUMENTS, parent::filterOptions([ |
|
| 631 | 631 | 'image', |
| 632 | 632 | 'kv_business', |
| 633 | 633 | ]), [ |
| 634 | 634 | 'access_token' => $this->_token, |
| 635 | 635 | ])); |
| 636 | - $this->_toArrayCall = function ($result) { |
|
| 636 | + $this->_toArrayCall = function($result) { |
|
| 637 | 637 | return I::get($result, 'words_result', []); |
| 638 | 638 | }; |
| 639 | 639 | |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | public function vehicleLicense() |
| 657 | 657 | { |
| 658 | 658 | $this->requestToken(); |
| 659 | - $this->_result = (array) Json::decode(Http::post(self::URL_VEHICLE_LICENSE, parent::filterOptions([ |
|
| 659 | + $this->_result = (array)Json::decode(Http::post(self::URL_VEHICLE_LICENSE, parent::filterOptions([ |
|
| 660 | 660 | 'image', |
| 661 | 661 | 'detect_direction', |
| 662 | 662 | 'accuracy', |
@@ -664,8 +664,8 @@ discard block |
||
| 664 | 664 | ]), [ |
| 665 | 665 | 'access_token' => $this->_token, |
| 666 | 666 | ])); |
| 667 | - $this->_toArrayCall = function ($result) { |
|
| 668 | - return Arrays::column((array) I::get($result, 'data.words_result', []), 'words'); |
|
| 667 | + $this->_toArrayCall = function($result) { |
|
| 668 | + return Arrays::column((array)I::get($result, 'data.words_result', []), 'words'); |
|
| 669 | 669 | }; |
| 670 | 670 | |
| 671 | 671 | return $this; |
@@ -687,15 +687,15 @@ discard block |
||
| 687 | 687 | public function drivingLicense() |
| 688 | 688 | { |
| 689 | 689 | $this->requestToken(); |
| 690 | - $this->_result = (array) Json::decode(Http::post(self::URL_DRIVING_LICENSE, parent::filterOptions([ |
|
| 690 | + $this->_result = (array)Json::decode(Http::post(self::URL_DRIVING_LICENSE, parent::filterOptions([ |
|
| 691 | 691 | 'image', |
| 692 | 692 | 'detect_direction', |
| 693 | 693 | 'unified_valid_period', |
| 694 | 694 | ]), [ |
| 695 | 695 | 'access_token' => $this->_token, |
| 696 | 696 | ])); |
| 697 | - $this->_toArrayCall = function ($result) { |
|
| 698 | - return Arrays::column((array) I::get($result, 'data.words_result', []), 'words'); |
|
| 697 | + $this->_toArrayCall = function($result) { |
|
| 698 | + return Arrays::column((array)I::get($result, 'data.words_result', []), 'words'); |
|
| 699 | 699 | }; |
| 700 | 700 | |
| 701 | 701 | return $this; |
@@ -717,13 +717,13 @@ discard block |
||
| 717 | 717 | public function licensePlate() |
| 718 | 718 | { |
| 719 | 719 | $this->requestToken(); |
| 720 | - $this->_result = (array) Json::decode(Http::post(self::URL_LICENSE_PLATE, parent::filterOptions([ |
|
| 720 | + $this->_result = (array)Json::decode(Http::post(self::URL_LICENSE_PLATE, parent::filterOptions([ |
|
| 721 | 721 | 'image', |
| 722 | 722 | 'multi_detect', |
| 723 | 723 | ]), [ |
| 724 | 724 | 'access_token' => $this->_token, |
| 725 | 725 | ])); |
| 726 | - $this->_toArrayCall = function ($result) { |
|
| 726 | + $this->_toArrayCall = function($result) { |
|
| 727 | 727 | return I::get($result, 'data.words_result', []); |
| 728 | 728 | }; |
| 729 | 729 | |
@@ -746,12 +746,12 @@ discard block |
||
| 746 | 746 | public function vinCode() |
| 747 | 747 | { |
| 748 | 748 | $this->requestToken(); |
| 749 | - $this->_result = (array) Json::decode(Http::post(self::URL_VIN_CODE, parent::filterOptions([ |
|
| 749 | + $this->_result = (array)Json::decode(Http::post(self::URL_VIN_CODE, parent::filterOptions([ |
|
| 750 | 750 | 'image', |
| 751 | 751 | ]), [ |
| 752 | 752 | 'access_token' => $this->_token, |
| 753 | 753 | ])); |
| 754 | - $this->_toArrayCall = function ($result) { |
|
| 754 | + $this->_toArrayCall = function($result) { |
|
| 755 | 755 | return I::get($result, 'words_result.0.words'); |
| 756 | 756 | }; |
| 757 | 757 | |
@@ -774,12 +774,12 @@ discard block |
||
| 774 | 774 | public function vehicleCertificate() |
| 775 | 775 | { |
| 776 | 776 | $this->requestToken(); |
| 777 | - $this->_result = (array) Json::decode(Http::post(self::URL_VEHICLE_CERTIFICATE, parent::filterOptions([ |
|
| 777 | + $this->_result = (array)Json::decode(Http::post(self::URL_VEHICLE_CERTIFICATE, parent::filterOptions([ |
|
| 778 | 778 | 'image', |
| 779 | 779 | ]), [ |
| 780 | 780 | 'access_token' => $this->_token, |
| 781 | 781 | ])); |
| 782 | - $this->_toArrayCall = function ($result) { |
|
| 782 | + $this->_toArrayCall = function($result) { |
|
| 783 | 783 | return I::get($result, 'words_result'); |
| 784 | 784 | }; |
| 785 | 785 | |
@@ -802,14 +802,14 @@ discard block |
||
| 802 | 802 | public function handwriting() |
| 803 | 803 | { |
| 804 | 804 | $this->requestToken(); |
| 805 | - $this->_result = (array) Json::decode(Http::post(self::URL_HANDWRITING, parent::filterOptions([ |
|
| 805 | + $this->_result = (array)Json::decode(Http::post(self::URL_HANDWRITING, parent::filterOptions([ |
|
| 806 | 806 | 'image', |
| 807 | 807 | 'recognize_granularity', |
| 808 | 808 | 'words_type', |
| 809 | 809 | ]), [ |
| 810 | 810 | 'access_token' => $this->_token, |
| 811 | 811 | ])); |
| 812 | - $this->_toArrayCall = function ($result) { |
|
| 812 | + $this->_toArrayCall = function($result) { |
|
| 813 | 813 | return I::get($result, 'words_result'); |
| 814 | 814 | }; |
| 815 | 815 | |
@@ -832,14 +832,14 @@ discard block |
||
| 832 | 832 | public function webImage() |
| 833 | 833 | { |
| 834 | 834 | $this->requestToken(); |
| 835 | - $this->_result = (array) Json::decode(Http::post(self::URL_WEB_IMAGE, parent::filterOptions([ |
|
| 835 | + $this->_result = (array)Json::decode(Http::post(self::URL_WEB_IMAGE, parent::filterOptions([ |
|
| 836 | 836 | 'image', |
| 837 | 837 | 'detect_direction', |
| 838 | 838 | 'detect_language', |
| 839 | 839 | ]), [ |
| 840 | 840 | 'access_token' => $this->_token, |
| 841 | 841 | ])); |
| 842 | - $this->_toArrayCall = function ($result) { |
|
| 842 | + $this->_toArrayCall = function($result) { |
|
| 843 | 843 | return I::get($result, 'words_result'); |
| 844 | 844 | }; |
| 845 | 845 | |
@@ -862,14 +862,14 @@ discard block |
||
| 862 | 862 | public function formRequest() |
| 863 | 863 | { |
| 864 | 864 | $this->requestToken(); |
| 865 | - $this->_result = (array) Json::decode(Http::post(self::URL_FORM_REQUEST, parent::filterOptions([ |
|
| 865 | + $this->_result = (array)Json::decode(Http::post(self::URL_FORM_REQUEST, parent::filterOptions([ |
|
| 866 | 866 | 'image', |
| 867 | 867 | 'is_sync', |
| 868 | 868 | 'request_type', |
| 869 | 869 | ]), [ |
| 870 | 870 | 'access_token' => $this->_token, |
| 871 | 871 | ])); |
| 872 | - $this->_toArrayCall = function ($result) { |
|
| 872 | + $this->_toArrayCall = function($result) { |
|
| 873 | 873 | return I::get($result, 'result.0'); |
| 874 | 874 | }; |
| 875 | 875 | |
@@ -892,13 +892,13 @@ discard block |
||
| 892 | 892 | public function formResult() |
| 893 | 893 | { |
| 894 | 894 | $this->requestToken(); |
| 895 | - $this->_result = (array) Json::decode(Http::post(self::URL_FORM_RESULT, parent::filterOptions([ |
|
| 895 | + $this->_result = (array)Json::decode(Http::post(self::URL_FORM_RESULT, parent::filterOptions([ |
|
| 896 | 896 | 'request_id', |
| 897 | 897 | 'request_type', |
| 898 | 898 | ]), [ |
| 899 | 899 | 'access_token' => $this->_token, |
| 900 | 900 | ])); |
| 901 | - $this->_toArrayCall = function ($result) { |
|
| 901 | + $this->_toArrayCall = function($result) { |
|
| 902 | 902 | return I::get($result, 'result', []); |
| 903 | 903 | }; |
| 904 | 904 | |
@@ -921,14 +921,14 @@ discard block |
||
| 921 | 921 | public function numbers() |
| 922 | 922 | { |
| 923 | 923 | $this->requestToken(); |
| 924 | - $this->_result = (array) Json::decode(Http::post(self::URL_NUMBERS, parent::filterOptions([ |
|
| 924 | + $this->_result = (array)Json::decode(Http::post(self::URL_NUMBERS, parent::filterOptions([ |
|
| 925 | 925 | 'image', |
| 926 | 926 | 'recognize_granularity', |
| 927 | 927 | 'detect_direction' |
| 928 | 928 | ]), [ |
| 929 | 929 | 'access_token' => $this->_token, |
| 930 | 930 | ])); |
| 931 | - $this->_toArrayCall = function ($result) { |
|
| 931 | + $this->_toArrayCall = function($result) { |
|
| 932 | 932 | return I::get($result, 'words_result.0.words', []); |
| 933 | 933 | }; |
| 934 | 934 | |
@@ -951,12 +951,12 @@ discard block |
||
| 951 | 951 | public function qrcode() |
| 952 | 952 | { |
| 953 | 953 | $this->requestToken(); |
| 954 | - $this->_result = (array) Json::decode(Http::post(self::URL_NUMBERS, parent::filterOptions([ |
|
| 954 | + $this->_result = (array)Json::decode(Http::post(self::URL_NUMBERS, parent::filterOptions([ |
|
| 955 | 955 | 'image' |
| 956 | 956 | ]), [ |
| 957 | 957 | 'access_token' => $this->_token, |
| 958 | 958 | ])); |
| 959 | - $this->_toArrayCall = function ($result) { |
|
| 959 | + $this->_toArrayCall = function($result) { |
|
| 960 | 960 | return I::get($result, 'codes_result', []); |
| 961 | 961 | }; |
| 962 | 962 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public static function stdin() |
| 152 | 152 | { |
| 153 | - return rtrim((string) fgets(\STDIN), PHP_EOL); |
|
| 153 | + return rtrim((string)fgets(\STDIN), PHP_EOL); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | /** |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | $input = self::stdin(); |
| 183 | 183 | if ('' === $input) { |
| 184 | - return (string) $defaultValue; |
|
| 184 | + return (string)$defaultValue; |
|
| 185 | 185 | } |
| 186 | 186 | return $input; |
| 187 | 187 | } |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | public static function moveCursorUp($rows = 1) |
| 244 | 244 | { |
| 245 | - echo '\033[' . (int) $rows . 'A'; |
|
| 245 | + echo '\033[' . (int)$rows . 'A'; |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | /** |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | public static function moveCursorDown($rows = 1) |
| 258 | 258 | { |
| 259 | - echo '\033[' . (int) $rows . 'B'; |
|
| 259 | + echo '\033[' . (int)$rows . 'B'; |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | /** |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | */ |
| 271 | 271 | public static function moveCursorForward($steps = 1) |
| 272 | 272 | { |
| 273 | - echo '\033[' . (int) $steps . 'C'; |
|
| 273 | + echo '\033[' . (int)$steps . 'C'; |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | /** |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | public static function moveCursorBackward($steps = 1) |
| 286 | 286 | { |
| 287 | - echo '\033[' . (int) $steps . 'D'; |
|
| 287 | + echo '\033[' . (int)$steps . 'D'; |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | /** |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | */ |
| 297 | 297 | public static function moveCursorNextLine($lines = 1) |
| 298 | 298 | { |
| 299 | - echo '\033[' . (int) $lines . 'E'; |
|
| 299 | + echo '\033[' . (int)$lines . 'E'; |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | /** |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | */ |
| 309 | 309 | public static function moveCursorPrevLine($lines = 1) |
| 310 | 310 | { |
| 311 | - echo '\033[' . (int) $lines . 'F'; |
|
| 311 | + echo '\033[' . (int)$lines . 'F'; |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | /** |
@@ -322,9 +322,9 @@ discard block |
||
| 322 | 322 | public static function moveCursorTo($column, $row = null) |
| 323 | 323 | { |
| 324 | 324 | if ($row === null) { |
| 325 | - echo '\033[' . (int) $column . 'G'; |
|
| 325 | + echo '\033[' . (int)$column . 'G'; |
|
| 326 | 326 | } else { |
| 327 | - echo '\033[' . (int) $row . ';' . (int) $column . 'H'; |
|
| 327 | + echo '\033[' . (int)$row . ';' . (int)$column . 'H'; |
|
| 328 | 328 | } |
| 329 | 329 | } |
| 330 | 330 | |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | */ |
| 340 | 340 | public static function scrollUp($lines = 1) |
| 341 | 341 | { |
| 342 | - echo '\033[' . (int) $lines . 'S'; |
|
| 342 | + echo '\033[' . (int)$lines . 'S'; |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | /** |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | */ |
| 354 | 354 | public static function scrollDown($lines = 1) |
| 355 | 355 | { |
| 356 | - echo '\033[' . (int) $lines . 'T'; |
|
| 356 | + echo '\033[' . (int)$lines . 'T'; |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | /** |
@@ -521,9 +521,9 @@ discard block |
||
| 521 | 521 | public static function exec($command) |
| 522 | 522 | { |
| 523 | 523 | if (class_exists('\Symfony\Component\Process\Process')) { |
| 524 | - try{ |
|
| 524 | + try { |
|
| 525 | 525 | $process = new \Symfony\Component\Process\Process($command); |
| 526 | - }catch(Exception $e){ |
|
| 526 | + } catch (Exception $e) { |
|
| 527 | 527 | $process = new \Symfony\Component\Process\Process(Strings::toArray($command, ' ')); |
| 528 | 528 | } |
| 529 | 529 | |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | return false; |
| 533 | 533 | } |
| 534 | 534 | return $process->getOutput(); |
| 535 | - }else{ |
|
| 535 | + } else { |
|
| 536 | 536 | return exec($command); |
| 537 | 537 | } |
| 538 | 538 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | $zoomWidth *= $this->_attributes['width']; |
| 152 | 152 | $zoomHeight *= $this->_attributes['height']; |
| 153 | 153 | } else { |
| 154 | - $zoom = (int) $zoom; |
|
| 154 | + $zoom = (int)$zoom; |
|
| 155 | 155 | $zoomWidth = $zoom * $this->_attributes['width']; |
| 156 | 156 | $zoomHeight = $zoom * $this->_attributes['height']; |
| 157 | 157 | } |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | * |
| 298 | 298 | * @return \icy2003\php\ihelpers\Color Color 类对象 |
| 299 | 299 | */ |
| 300 | - public function getColor($x, $y){ |
|
| 300 | + public function getColor($x, $y) { |
|
| 301 | 301 | $rgb = imagecolorat($this->_attributes['object'], $x, $y); |
| 302 | 302 | return new Color([($rgb >> 16) & 0xFF, ($rgb >> 8) & 0xFF, $rgb & 0xFF], Color::TYPE_RGB); |
| 303 | 303 | } |