@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | // | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library |
| 15 | 15 | // +---------------------------------------------------------------------- |
| 16 | 16 | |
| 17 | -declare (strict_types=1); |
|
| 17 | +declare(strict_types=1); |
|
| 18 | 18 | |
| 19 | 19 | namespace DtApp\ThinkLibrary\extend; |
| 20 | 20 | |
@@ -57,14 +57,14 @@ discard block |
||
| 57 | 57 | if (!isset($array) || empty($array)) { |
| 58 | 58 | return $arrRet; |
| 59 | 59 | } |
| 60 | - $iCount = count($array) / $num; |
|
| 60 | + $iCount = count($array)/$num; |
|
| 61 | 61 | if (!is_int($iCount)) { |
| 62 | 62 | $iCount = ceil($iCount); |
| 63 | - } else { |
|
| 63 | + }else { |
|
| 64 | 64 | ++$iCount; |
| 65 | 65 | } |
| 66 | 66 | for ($i = 0; $i < $iCount; ++$i) { |
| 67 | - $arrInfos = array_slice($array, $i * $num, $num); |
|
| 67 | + $arrInfos = array_slice($array, $i*$num, $num); |
|
| 68 | 68 | if (empty($arrInfos)) { |
| 69 | 69 | continue; |
| 70 | 70 | } |
@@ -106,11 +106,11 @@ discard block |
||
| 106 | 106 | foreach ($arrays as $array) { |
| 107 | 107 | if (is_array($array)) { |
| 108 | 108 | $key_arrays[] = $array[$sort_key]; |
| 109 | - } else { |
|
| 109 | + }else { |
|
| 110 | 110 | return []; |
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | - } else { |
|
| 113 | + }else { |
|
| 114 | 114 | return []; |
| 115 | 115 | } |
| 116 | 116 | array_multisort($key_arrays, $sort_order, $sort_type, $arrays); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | foreach ($arr as $key => $value) { |
| 131 | 131 | if (is_array($value)) { |
| 132 | 132 | $arr[$key] = self::TrimArray($value); |
| 133 | - } else { |
|
| 133 | + }else { |
|
| 134 | 134 | $arr[$key] = self::trimAll($value); |
| 135 | 135 | } |
| 136 | 136 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | // | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library |
| 15 | 15 | // +---------------------------------------------------------------------- |
| 16 | 16 | |
| 17 | -declare (strict_types=1); |
|
| 17 | +declare(strict_types=1); |
|
| 18 | 18 | |
| 19 | 19 | namespace DtApp\ThinkLibrary\extend; |
| 20 | 20 | |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | if ($type === 3) { |
| 44 | 44 | $chars = "{$numbs}{$chars}"; |
| 45 | 45 | } |
| 46 | - $code = $prefix . $chars[random_int(1, strlen($chars) - 1)]; |
|
| 46 | + $code = $prefix.$chars[random_int(1, strlen($chars)-1)]; |
|
| 47 | 47 | while (strlen($code) < $size) { |
| 48 | - $code .= $chars[random_int(0, strlen($chars) - 1)]; |
|
| 48 | + $code .= $chars[random_int(0, strlen($chars)-1)]; |
|
| 49 | 49 | } |
| 50 | 50 | return $code; |
| 51 | 51 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | if ($size < 14) { |
| 63 | 63 | $size = 14; |
| 64 | 64 | } |
| 65 | - $code = $prefix . date('Ymd') . (date('H') + date('i')) . date('s'); |
|
| 65 | + $code = $prefix.date('Ymd').(date('H')+date('i')).date('s'); |
|
| 66 | 66 | while (strlen($code) < $size) { |
| 67 | 67 | $code .= random_int(0, 9); |
| 68 | 68 | } |
@@ -78,11 +78,11 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public static function uniqidNumber(int $size = 12, string $prefix = ''): string |
| 80 | 80 | { |
| 81 | - $time = time() . ''; |
|
| 81 | + $time = time().''; |
|
| 82 | 82 | if ($size < 10) { |
| 83 | 83 | $size = 10; |
| 84 | 84 | } |
| 85 | - $code = $prefix . ((int)$time[0] + (int)$time[1]) . substr($time, 2) . random_int(0, 9); |
|
| 85 | + $code = $prefix.((int)$time[0]+(int)$time[1]).substr($time, 2).random_int(0, 9); |
|
| 86 | 86 | while (strlen($code) < $size) { |
| 87 | 87 | $code .= random_int(0, 9); |
| 88 | 88 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | // | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library |
| 15 | 15 | // +---------------------------------------------------------------------- |
| 16 | 16 | |
| 17 | -declare (strict_types=1); |
|
| 17 | +declare(strict_types=1); |
|
| 18 | 18 | |
| 19 | 19 | namespace DtApp\ThinkLibrary\helper; |
| 20 | 20 | |
@@ -57,14 +57,14 @@ discard block |
||
| 57 | 57 | if (!isset($array) || empty($array)) { |
| 58 | 58 | return $arrRet; |
| 59 | 59 | } |
| 60 | - $iCount = count($array) / $num; |
|
| 60 | + $iCount = count($array)/$num; |
|
| 61 | 61 | if (!is_int($iCount)) { |
| 62 | 62 | $iCount = ceil($iCount); |
| 63 | - } else { |
|
| 63 | + }else { |
|
| 64 | 64 | ++$iCount; |
| 65 | 65 | } |
| 66 | 66 | for ($i = 0; $i < $iCount; ++$i) { |
| 67 | - $arrInfos = array_slice($array, $i * $num, $num); |
|
| 67 | + $arrInfos = array_slice($array, $i*$num, $num); |
|
| 68 | 68 | if (empty($arrInfos)) { |
| 69 | 69 | continue; |
| 70 | 70 | } |
@@ -106,11 +106,11 @@ discard block |
||
| 106 | 106 | foreach ($arrays as $array) { |
| 107 | 107 | if (is_array($array)) { |
| 108 | 108 | $key_arrays[] = $array[$sort_key]; |
| 109 | - } else { |
|
| 109 | + }else { |
|
| 110 | 110 | return []; |
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | - } else { |
|
| 113 | + }else { |
|
| 114 | 114 | return []; |
| 115 | 115 | } |
| 116 | 116 | array_multisort($key_arrays, $sort_order, $sort_type, $arrays); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | foreach ($arr as $key => $value) { |
| 131 | 131 | if (is_array($value)) { |
| 132 | 132 | $arr[$key] = $this->TrimArray($value); |
| 133 | - } else { |
|
| 133 | + }else { |
|
| 134 | 134 | $arr[$key] = $this->trimAll($value); |
| 135 | 135 | } |
| 136 | 136 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | * @param $array |
| 170 | 170 | * @return array |
| 171 | 171 | */ |
| 172 | - public function valChunk($array,$name): array |
|
| 172 | + public function valChunk($array, $name): array |
|
| 173 | 173 | { |
| 174 | 174 | $result = array(); |
| 175 | 175 | $ar2 = []; |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | // 判断访问模式,兼容 CLI 访问控制器 |
| 51 | 51 | if (!$this->app->request->isCli()) { |
| 52 | 52 | // 注册访问处理中间键 |
| 53 | - $this->app->middleware->add(function (Request $request) { |
|
| 53 | + $this->app->middleware->add(function(Request $request) { |
|
| 54 | 54 | $header = []; |
| 55 | 55 | if (($origin = $request->header('origin', '*')) !== '*') { |
| 56 | 56 | $header['Access-Control-Allow-Origin'] = $origin; |