@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public static function toCamel($string) |
| 110 | 110 | { |
| 111 | - return lcfirst(preg_replace_callback('/_+([a-z0-9_\x7f-\xff])/', function ($matches) { |
|
| 111 | + return lcfirst(preg_replace_callback('/_+([a-z0-9_\x7f-\xff])/', function($matches) { |
|
| 112 | 112 | return ucfirst($matches[1]); |
| 113 | 113 | }, strtolower($string))); |
| 114 | 114 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public static function isStartsWith($string, $search) |
| 141 | 141 | { |
| 142 | - return (string) $search !== "" && mb_strpos($string, $search) === 0; |
|
| 142 | + return (string)$search !== "" && mb_strpos($string, $search) === 0; |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | public static function isEndsWith($string, $search) |
| 156 | 156 | { |
| 157 | - return (string) $search !== "" && mb_substr($string, -static::length($search)) === $search; |
|
| 157 | + return (string)$search !== "" && mb_substr($string, -static::length($search)) === $search; |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /** |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | public static function isContains($string, $search, &$pos = null) |
| 172 | 172 | { |
| 173 | - return (string) $search !== "" && ($pos = mb_strpos($string, $search)) !== false; |
|
| 173 | + return (string)$search !== "" && ($pos = mb_strpos($string, $search)) !== false; |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | /** |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | $array = []; |
| 67 | 67 | if (self::TYPE_INI === $this->_type) { |
| 68 | 68 | foreach ($local->linesGenerator($this->_file, true) as $line) { |
| 69 | - list($name, $value) = Arrays::lists(explode('=', $line), 2, function ($row) {return trim($row);}); |
|
| 69 | + list($name, $value) = Arrays::lists(explode('=', $line), 2, function($row) {return trim($row); }); |
|
| 70 | 70 | $array[$name] = $value; |
| 71 | 71 | } |
| 72 | 72 | } elseif (self::TYPE_JSON === $this->_type) { |
@@ -229,7 +229,7 @@ |
||
| 229 | 229 | public static function toPinyinFirst($text, $returnArray = false) |
| 230 | 230 | { |
| 231 | 231 | $array = self::toPinyin($text, true); |
| 232 | - $result = array_map(function ($row) { |
|
| 232 | + $result = array_map(function($row) { |
|
| 233 | 233 | return self::sub($row, 0, 1); |
| 234 | 234 | }, $array); |
| 235 | 235 | return true === $returnArray ? $result : implode('', $result); |
@@ -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, // 为了简化正则 |