@@ -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; |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | if (Strings::isStartsWith(trim($line), '#')) { |
| 71 | 71 | continue; |
| 72 | 72 | } |
| 73 | - list($name, $value) = Arrays::lists(explode('=', $line), 2, function ($row) {return trim($row);}); |
|
| 73 | + list($name, $value) = Arrays::lists(explode('=', $line), 2, function($row) {return trim($row); }); |
|
| 74 | 74 | $array[$name] = $value; |
| 75 | 75 | // 如果值被 [] 包括,则以英文逗号为分割,将值变成数组 |
| 76 | 76 | if (Strings::isStartsWith($value, '[') && Strings::isEndsWith($value, ']')) { |
@@ -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 | /** |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | } elseif (false === $returnArray) { |
| 535 | 535 | return implode('', $result); |
| 536 | 536 | } else { |
| 537 | - return implode((string) $returnArray, $result); |
|
| 537 | + return implode((string)$returnArray, $result); |
|
| 538 | 538 | } |
| 539 | 539 | } |
| 540 | 540 | |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | public static function toPinyinFirst($text, $returnArray = false) |
| 550 | 550 | { |
| 551 | 551 | $array = self::toPinyin($text, true); |
| 552 | - $result = array_map(function ($row) { |
|
| 552 | + $result = array_map(function($row) { |
|
| 553 | 553 | return self::sub($row, 0, 1); |
| 554 | 554 | }, $array); |
| 555 | 555 | return true === $returnArray ? $result : implode('', $result); |
@@ -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 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | 'charset' => 'UTF-8', |
| 76 | 76 | ])); |
| 77 | 77 | |
| 78 | - $this->_toArrayCall = function ($result) { |
|
| 78 | + $this->_toArrayCall = function($result) { |
|
| 79 | 79 | return Arrays::column(I::get($result, 'items'), 'item'); |
| 80 | 80 | }; |
| 81 | 81 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | 'access_token' => $this->_token, |
| 104 | 104 | 'charset' => 'UTF-8', |
| 105 | 105 | ])); |
| 106 | - $this->_toArrayCall = function ($result) { |
|
| 106 | + $this->_toArrayCall = function($result) { |
|
| 107 | 107 | return Arrays::column(I::get($result, 'items'), 'word'); |
| 108 | 108 | }; |
| 109 | 109 | |
@@ -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 | |
@@ -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; |