@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | ]), [ |
| 103 | 103 | 'access_token' => $this->_token, |
| 104 | 104 | ])); |
| 105 | - $this->_toArrayCall = function ($result) { |
|
| 105 | + $this->_toArrayCall = function($result) { |
|
| 106 | 106 | return Arrays::column(I::get($result, 'words_result'), 'words'); |
| 107 | 107 | }; |
| 108 | 108 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | ]), [ |
| 129 | 129 | 'access_token' => $this->_token, |
| 130 | 130 | ])); |
| 131 | - $this->_toArrayCall = function ($result) { |
|
| 131 | + $this->_toArrayCall = function($result) { |
|
| 132 | 132 | return Arrays::column(I::get($result, 'words_result'), 'words'); |
| 133 | 133 | }; |
| 134 | 134 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | ]), [ |
| 159 | 159 | 'access_token' => $this->_token, |
| 160 | 160 | ])); |
| 161 | - $this->_toArrayCall = function ($result) { |
|
| 161 | + $this->_toArrayCall = function($result) { |
|
| 162 | 162 | return I::get($result, 'words_result'); |
| 163 | 163 | }; |
| 164 | 164 | |
@@ -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 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | ]), [ |
| 213 | 213 | 'access_token' => $this->_token, |
| 214 | 214 | ])); |
| 215 | - $this->_toArrayCall = function ($result) { |
|
| 215 | + $this->_toArrayCall = function($result) { |
|
| 216 | 216 | return I::get($result, 'words_result'); |
| 217 | 217 | }; |
| 218 | 218 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | $this->_result = Json::decode(Http::post('https://aip.baidubce.com/rest/2.0/ocr/v1/idcard', $options, [ |
| 241 | 241 | 'access_token' => $this->_token, |
| 242 | 242 | ])); |
| 243 | - $this->_toArrayCall = function ($result) { |
|
| 243 | + $this->_toArrayCall = function($result) { |
|
| 244 | 244 | $return = []; |
| 245 | 245 | $words = I::get($result, 'words_result', []); |
| 246 | 246 | foreach ($words as $name => $word) { |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | $this->_result = Json::decode(Http::post('https://aip.baidubce.com/rest/2.0/ocr/v1/bankcard', $options, [ |
| 267 | 267 | 'access_token' => $this->_token, |
| 268 | 268 | ])); |
| 269 | - $this->_toArrayCall = function ($result) { |
|
| 269 | + $this->_toArrayCall = function($result) { |
|
| 270 | 270 | return I::get($result, 'result'); |
| 271 | 271 | }; |
| 272 | 272 | return $this; |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function dayRange($offset = 0) |
| 40 | 40 | { |
| 41 | - $day = (int) (date('d') + $offset); |
|
| 41 | + $day = (int)(date('d') + $offset); |
|
| 42 | 42 | return [ |
| 43 | - mktime(0, 0, 0, (int) date('m'), $day, (int) date('Y')), |
|
| 44 | - mktime(23, 59, 59, (int) date('m'), $day, (int) date('Y')), |
|
| 43 | + mktime(0, 0, 0, (int)date('m'), $day, (int)date('Y')), |
|
| 44 | + mktime(23, 59, 59, (int)date('m'), $day, (int)date('Y')), |
|
| 45 | 45 | ]; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | public function weekRange($offset = 0) |
| 58 | 58 | { |
| 59 | 59 | $timestamp = time(); |
| 60 | - $offset = (int) $offset; |
|
| 60 | + $offset = (int)$offset; |
|
| 61 | 61 | return [ |
| 62 | 62 | strtotime(date('Y-m-d', strtotime('Sunday ' . ($offset - 1) . ' week', $timestamp))), |
| 63 | 63 | strtotime(date('Y-m-d', strtotime('Saturday ' . $offset . ' week', $timestamp))) + 24 * 3600 - 1, |
@@ -73,9 +73,9 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function monthRange($offset = 0) |
| 75 | 75 | { |
| 76 | - $month = (int) (date('m') + $offset); |
|
| 77 | - $begin = mktime(0, 0, 0, $month, 1, (int) date('Y')); |
|
| 78 | - $end = mktime(23, 59, 59, $month, (int) date('t', $begin), (int) date('Y')); |
|
| 76 | + $month = (int)(date('m') + $offset); |
|
| 77 | + $begin = mktime(0, 0, 0, $month, 1, (int)date('Y')); |
|
| 78 | + $end = mktime(23, 59, 59, $month, (int)date('t', $begin), (int)date('Y')); |
|
| 79 | 79 | |
| 80 | 80 | return [$begin, $end]; |
| 81 | 81 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function yearRange($offset = 0) |
| 91 | 91 | { |
| 92 | - $year = (int) (date('Y') + $offset); |
|
| 92 | + $year = (int)(date('Y') + $offset); |
|
| 93 | 93 | return [ |
| 94 | 94 | mktime(0, 0, 0, 1, 1, $year), |
| 95 | 95 | mktime(23, 59, 59, 12, 31, $year), |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | public function day($offset = 0, $time = null) |
| 108 | 108 | { |
| 109 | 109 | $timestamp = null === $time ? time() : $time; |
| 110 | - $offset = (int) $offset; |
|
| 110 | + $offset = (int)$offset; |
|
| 111 | 111 | return $timestamp + 3600 * 24 * $offset; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | public function week($offset = 0, $time = null) |
| 123 | 123 | { |
| 124 | 124 | $timestamp = null === $time ? time() : $time; |
| 125 | - $offset = (int) $offset; |
|
| 125 | + $offset = (int)$offset; |
|
| 126 | 126 | return $timestamp + 3600 * 24 * 7 * $offset; |
| 127 | 127 | } |
| 128 | 128 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | public function month($offset = 0, $time = null) |
| 138 | 138 | { |
| 139 | 139 | $timestamp = null === $time ? time() : $time; |
| 140 | - $offset = (int) $offset; |
|
| 140 | + $offset = (int)$offset; |
|
| 141 | 141 | return $timestamp + 3600 * 24 * date('t', $timestamp) * $offset; |
| 142 | 142 | } |
| 143 | 143 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | public function year($offset = 0, $time = null) |
| 153 | 153 | { |
| 154 | 154 | $timestamp = null === $time ? time() : $time; |
| 155 | - $offset = (int) $offset; |
|
| 155 | + $offset = (int)$offset; |
|
| 156 | 156 | return $timestamp + 3600 * 24 * (date('z', mktime(0, 0, 0, 12, 31, date('Y', $timestamp))) + 1) * $offset; |
| 157 | 157 | } |
| 158 | 158 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | public function isLeapYear($time = null) |
| 193 | 193 | { |
| 194 | 194 | $timestamp = null === $time ? time() : $time; |
| 195 | - return (bool) date('L', $timestamp); |
|
| 195 | + return (bool)date('L', $timestamp); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | /** |
@@ -207,6 +207,6 @@ discard block |
||
| 207 | 207 | public function yearPosition($time = null) |
| 208 | 208 | { |
| 209 | 209 | $timestamp = null === $time ? time() : $time; |
| 210 | - return (int) date('z', $timestamp) + 1; |
|
| 210 | + return (int)date('z', $timestamp) + 1; |
|
| 211 | 211 | } |
| 212 | 212 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | public static function combine($keys, $values) |
| 155 | 155 | { |
| 156 | 156 | if (count($keys) == count($values)) { |
| 157 | - return (array) array_combine($keys, $values); |
|
| 157 | + return (array)array_combine($keys, $values); |
|
| 158 | 158 | } |
| 159 | 159 | $array = []; |
| 160 | 160 | foreach ($keys as $index => $key) { |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | } else { |
| 472 | 472 | $function = $callback; |
| 473 | 473 | if (false === is_callable($callback)) { |
| 474 | - $function = function ($row) use ($callback, $isStrict) { |
|
| 474 | + $function = function($row) use ($callback, $isStrict) { |
|
| 475 | 475 | return true === $isStrict ? $row === $callback : $row == $callback; |
| 476 | 476 | }; |
| 477 | 477 | } |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | */ |
| 77 | 77 | public static function toBytes($size) |
| 78 | 78 | { |
| 79 | - $callback = function ($matches) { |
|
| 79 | + $callback = function($matches) { |
|
| 80 | 80 | $sizeMap = [ |
| 81 | 81 | '' => 0, |
| 82 | 82 | 'b' => 0, // 为了简化正则 |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | { |
| 335 | 335 | $type = $this->_type; |
| 336 | 336 | if (self::TYPE_RGB === $type) { |
| 337 | - $this->_color = array_map(function ($i) { |
|
| 337 | + $this->_color = array_map(function($i) { |
|
| 338 | 338 | return (0.5 + $i) | 0; |
| 339 | 339 | }, $this->_color); |
| 340 | 340 | } elseif (self::TYPE_HEX === $type) { |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | { |
| 388 | 388 | $type = $this->_type; |
| 389 | 389 | if (self::TYPE_CMYK === $type) { |
| 390 | - $this->_color = array_map(function ($i) { |
|
| 390 | + $this->_color = array_map(function($i) { |
|
| 391 | 391 | return sprintf('%01.4f', $i); |
| 392 | 392 | }, $this->_color); |
| 393 | 393 | $this->_type = self::TYPE_CMYK; |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | public static function toCamel($string) |
| 112 | 112 | { |
| 113 | - return lcfirst(preg_replace_callback('/_+([a-z0-9_\x7f-\xff])/', function ($matches) { |
|
| 113 | + return lcfirst(preg_replace_callback('/_+([a-z0-9_\x7f-\xff])/', function($matches) { |
|
| 114 | 114 | return ucfirst($matches[1]); |
| 115 | 115 | }, strtolower($string))); |
| 116 | 116 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | public static function isStartsWith($string, $search) |
| 143 | 143 | { |
| 144 | - return (string) $search !== "" && mb_strpos($string, $search) === 0; |
|
| 144 | + return (string)$search !== "" && mb_strpos($string, $search) === 0; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | public static function isEndsWith($string, $search) |
| 158 | 158 | { |
| 159 | - return (string) $search !== "" && mb_substr($string, -static::length($search)) === $search; |
|
| 159 | + return (string)$search !== "" && mb_substr($string, -static::length($search)) === $search; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | public static function isContains($string, $search, &$pos = null) |
| 174 | 174 | { |
| 175 | - return (string) $search !== "" && ($pos = mb_strpos($string, $search)) !== false; |
|
| 175 | + return (string)$search !== "" && ($pos = mb_strpos($string, $search)) !== false; |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /** |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | */ |
| 294 | 294 | public static function toNumber($string) |
| 295 | 295 | { |
| 296 | - return (double) $string; |
|
| 296 | + return (double)$string; |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | /** |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | public static function toPinyinFirst($text, $returnArray = false) |
| 544 | 544 | { |
| 545 | 545 | $array = self::toPinyin($text, true); |
| 546 | - $result = array_map(function ($row) { |
|
| 546 | + $result = array_map(function($row) { |
|
| 547 | 547 | return self::sub($row, 0, 1); |
| 548 | 548 | }, $array); |
| 549 | 549 | return true === $returnArray ? $result : implode('', $result); |