@@ -166,8 +166,4 @@ |
||
| 166 | 166 | $local->putFileContent($file, <<<EOT |
| 167 | 167 | <?php |
| 168 | 168 | |
| 169 | -return {$array}; |
|
| 170 | - |
|
| 171 | -EOT); |
|
| 172 | - } |
|
| 173 | -} |
|
| 169 | +return {$array} |
|
| 174 | 170 | \ No newline at end of file |
@@ -166,8 +166,4 @@ |
||
| 166 | 166 | $local->putFileContent($file, <<<EOT |
| 167 | 167 | <?php |
| 168 | 168 | |
| 169 | -return {$array}; |
|
| 170 | - |
|
| 171 | -EOT); |
|
| 172 | - } |
|
| 173 | -} |
|
| 169 | +return {$array} |
|
| 174 | 170 | \ No newline at end of file |
@@ -166,8 +166,4 @@ |
||
| 166 | 166 | $local->putFileContent($file, <<<EOT |
| 167 | 167 | <?php |
| 168 | 168 | |
| 169 | -return {$array}; |
|
| 170 | - |
|
| 171 | -EOT); |
|
| 172 | - } |
|
| 173 | -} |
|
| 169 | +return {$array} |
|
| 174 | 170 | \ No newline at end of file |
@@ -166,8 +166,4 @@ |
||
| 166 | 166 | $local->putFileContent($file, <<<EOT |
| 167 | 167 | <?php |
| 168 | 168 | |
| 169 | -return {$array}; |
|
| 170 | - |
|
| 171 | -EOT); |
|
| 172 | - } |
|
| 173 | -} |
|
| 169 | +return {$array} |
|
| 174 | 170 | \ No newline at end of file |
@@ -166,8 +166,4 @@ |
||
| 166 | 166 | $local->putFileContent($file, <<<EOT |
| 167 | 167 | <?php |
| 168 | 168 | |
| 169 | -return {$array}; |
|
| 170 | - |
|
| 171 | -EOT); |
|
| 172 | - } |
|
| 173 | -} |
|
| 169 | +return {$array} |
|
| 174 | 170 | \ No newline at end of file |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $arr = []; |
| 96 | 96 | for ($r = 0; $r < $row1; $r++) { |
| 97 | 97 | for ($c = 0; $c < $col2; $c++) { |
| 98 | - $arr[$r][$c] = array_sum(array_map(function ($a1, $a2) { |
|
| 98 | + $arr[$r][$c] = array_sum(array_map(function($a1, $a2) { |
|
| 99 | 99 | return $a1 * $a2; |
| 100 | 100 | }, $array1[$r], Arrays::column($array2, $c))); |
| 101 | 101 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | public static function multinomial($number1) |
| 145 | 145 | { |
| 146 | 146 | $numbers = is_array($number1) ? $number1 : func_get_args(); |
| 147 | - return self::fact(array_sum($numbers)) / array_product(array_map(function ($num) { |
|
| 147 | + return self::fact(array_sum($numbers)) / array_product(array_map(function($num) { |
|
| 148 | 148 | return self::fact($num); |
| 149 | 149 | }, $numbers)); |
| 150 | 150 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $k = 1; |
| 80 | 80 | for ($i = 0; $i < $row; $i++) { |
| 81 | 81 | for ($j = 0; $j < $col; $j++) { |
| 82 | - $array[$i][$j] = $start + ($k++ - 1) * $step; |
|
| 82 | + $array[$i][$j] = $start + ($k++ -1) * $step; |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | return $array; |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | array_push($arr[$i], $array[$i]); |
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | - return array_sum(array_map(function ($rows) { |
|
| 219 | + return array_sum(array_map(function($rows) { |
|
| 220 | 220 | return array_product($rows); |
| 221 | 221 | }, $arr)); |
| 222 | 222 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | public static function sumsq($number1) |
| 232 | 232 | { |
| 233 | 233 | $numbers = is_array($number1) ? $number1 : func_get_args(); |
| 234 | - return array_sum(array_map(function ($num) { |
|
| 234 | + return array_sum(array_map(function($num) { |
|
| 235 | 235 | return $num * $num; |
| 236 | 236 | }, $numbers)); |
| 237 | 237 | } |
@@ -23,6 +23,6 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | public static function quotient($numberator, $denominator) |
| 25 | 25 | { |
| 26 | - return (int) ($numberator / $denominator); |
|
| 26 | + return (int)($numberator / $denominator); |
|
| 27 | 27 | } |
| 28 | 28 | } |
@@ -27,6 +27,6 @@ |
||
| 27 | 27 | if ($number % 2 == 0) { |
| 28 | 28 | $number += 1; |
| 29 | 29 | } |
| 30 | - return (int) ($sign * $number); |
|
| 30 | + return (int)($sign * $number); |
|
| 31 | 31 | } |
| 32 | 32 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public static function fact($number) |
| 26 | 26 | { |
| 27 | - $number = (int) floor($number); |
|
| 27 | + $number = (int)floor($number); |
|
| 28 | 28 | if ($number == 0) { |
| 29 | 29 | return 1; |
| 30 | 30 | } elseif ($number < 0) { |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | $result = 1; |
| 56 | 56 | $isEven = $number % 2 == 0; |
| 57 | - foreach (Arrays::rangeGenerator($isEven ? 2 : 1, (int) $number, 2) as $num) { |
|
| 57 | + foreach (Arrays::rangeGenerator($isEven ? 2 : 1, (int)$number, 2) as $num) { |
|
| 58 | 58 | $result *= $num; |
| 59 | 59 | } |
| 60 | 60 | return $result; |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | if ($number % 2 == 1) { |
| 30 | 30 | $number += 1; |
| 31 | 31 | } |
| 32 | - return (int) ($sign * $number); |
|
| 32 | + return (int)($sign * $number); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public static function rand() |
| 34 | 34 | { |
| 35 | - return mt_rand(0, (int) self::power(10, 10)) / self::power(10, 10); |
|
| 35 | + return mt_rand(0, (int)self::power(10, 10)) / self::power(10, 10); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -48,11 +48,11 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public static function randarray($row = 1, $col = 1, $min = 0, $max = null, $isInt = false) |
| 50 | 50 | { |
| 51 | - null === $max && $max = (int) pow(10, 10); |
|
| 51 | + null === $max && $max = (int)pow(10, 10); |
|
| 52 | 52 | $array = []; |
| 53 | 53 | for ($i = 0; $i < $row; $i++) { |
| 54 | 54 | for ($j = 0; $j < $col; $j++) { |
| 55 | - $array[$i][$j] = mt_rand($min, $max - 1) + ($isInt ? 0 : mt_rand(0, (int) pow(10, 10)) / pow(10, 10)); |
|
| 55 | + $array[$i][$j] = mt_rand($min, $max - 1) + ($isInt ? 0 : mt_rand(0, (int)pow(10, 10)) / pow(10, 10)); |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | return $array; |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | public function fetchProvinces() |
| 21 | 21 | { |
| 22 | 22 | $this->fetchCitys(); |
| 23 | - $this->_toArrayCall = function ($array) { |
|
| 23 | + $this->_toArrayCall = function($array) { |
|
| 24 | 24 | return Arrays::columns($array, ['code', 'name']); |
| 25 | 25 | }; |
| 26 | 26 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | { |
| 39 | 39 | $res = Http::get('http://www.nmc.cn/f/rest/province/' . $provinceCode); |
| 40 | 40 | $this->_result = Json::decode($res); |
| 41 | - $this->_toArrayCall = function ($array) { |
|
| 41 | + $this->_toArrayCall = function($array) { |
|
| 42 | 42 | return Arrays::columns($array, ['code', 'city', 'province']); |
| 43 | 43 | }; |
| 44 | 44 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | $res = Http::get('http://www.nmc.cn/f/rest/real/' . $cityId); |
| 74 | 74 | $this->_result = Json::decode($res); |
| 75 | - $this->_toArrayCall = function ($array) { |
|
| 75 | + $this->_toArrayCall = function($array) { |
|
| 76 | 76 | return Arrays::columns($array, [ |
| 77 | 77 | 'publish_time', |
| 78 | 78 | 'airpressure' => 'weather.airpressure', |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | { |
| 108 | 108 | $res = Http::get('http://www.nmc.cn/f/rest/aqi/' . $cityId); |
| 109 | 109 | $this->_result = Json::decode($res); |
| 110 | - $this->_toArrayCall = function ($array) { |
|
| 110 | + $this->_toArrayCall = function($array) { |
|
| 111 | 111 | return Arrays::columns($array, [ |
| 112 | 112 | 'forecasttime', |
| 113 | 113 | 'aq', |
@@ -132,10 +132,10 @@ discard block |
||
| 132 | 132 | * |
| 133 | 133 | * @return static |
| 134 | 134 | */ |
| 135 | - public function fetchToday($cityId){ |
|
| 135 | + public function fetchToday($cityId) { |
|
| 136 | 136 | $res = Http::get('http://www.nmc.cn/f/rest/passed/' . $cityId); |
| 137 | 137 | $this->_result = Json::decode($res); |
| 138 | - $this->_toArrayCall = function ($array) { |
|
| 138 | + $this->_toArrayCall = function($array) { |
|
| 139 | 139 | return Arrays::columns($array, [ |
| 140 | 140 | 'time', |
| 141 | 141 | 'humidity', |