@@ -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; |