@@ -75,9 +75,9 @@ |
||
75 | 75 | } elseif (property_exists($mixed, $key) && null !== $mixed->$key) { |
76 | 76 | $mixed = $mixed->$key; |
77 | 77 | } else { |
78 | - try{ |
|
78 | + try { |
|
79 | 79 | $mixed = $mixed->$key; |
80 | - }catch(Exception $e){ |
|
80 | + } catch (Exception $e) { |
|
81 | 81 | return $defaultValue; |
82 | 82 | } |
83 | 83 |
@@ -77,7 +77,7 @@ |
||
77 | 77 | } else { |
78 | 78 | try{ |
79 | 79 | $mixed = $mixed->$key; |
80 | - }catch(Exception $e){ |
|
80 | + } catch(Exception $e){ |
|
81 | 81 | return $defaultValue; |
82 | 82 | } |
83 | 83 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | public function fetchProvinces() |
22 | 22 | { |
23 | 23 | $this->fetchCitys(); |
24 | - $this->_toArrayCall = function ($array) { |
|
24 | + $this->_toArrayCall = function($array) { |
|
25 | 25 | return Arrays::columns($array, ['code', 'name']); |
26 | 26 | }; |
27 | 27 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | $res = Http::get('http://www.nmc.cn/f/rest/province/' . $provinceCode); |
39 | 39 | $this->_result = Json::decode($res); |
40 | - $this->_toArrayCall = function ($array) { |
|
40 | + $this->_toArrayCall = function($array) { |
|
41 | 41 | return Arrays::columns($array, ['code', 'city', 'province']); |
42 | 42 | }; |
43 | 43 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | { |
70 | 70 | $res = Http::get('http://www.nmc.cn/f/rest/real/' . $cityId); |
71 | 71 | $this->_result = Json::decode($res); |
72 | - $this->_toArrayCall = function ($array) { |
|
72 | + $this->_toArrayCall = function($array) { |
|
73 | 73 | return Arrays::columns($array, [ |
74 | 74 | 'publish_time', |
75 | 75 | 'airpressure' => 'weather.airpressure', |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | { |
103 | 103 | $res = Http::get('http://www.nmc.cn/f/rest/aqi/' . $cityId); |
104 | 104 | $this->_result = Json::decode($res); |
105 | - $this->_toArrayCall = function ($array) { |
|
105 | + $this->_toArrayCall = function($array) { |
|
106 | 106 | return Arrays::columns($array, [ |
107 | 107 | 'forecasttime', |
108 | 108 | 'aq', |
@@ -125,10 +125,10 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @return void |
127 | 127 | */ |
128 | - public function fetchToday($cityId){ |
|
128 | + public function fetchToday($cityId) { |
|
129 | 129 | $res = Http::get('http://www.nmc.cn/f/rest/passed/' . $cityId); |
130 | 130 | $this->_result = Json::decode($res); |
131 | - $this->_toArrayCall = function ($array) { |
|
131 | + $this->_toArrayCall = function($array) { |
|
132 | 132 | return Arrays::columns($array, [ |
133 | 133 | 'time', |
134 | 134 | 'humidity', |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | foreach ($array as $k => $row) { |
80 | 80 | foreach ($keys as $k1 => $key) { |
81 | 81 | $value = I::get($row, $key); |
82 | - if(is_numeric($k1)){ |
|
82 | + if (is_numeric($k1)) { |
|
83 | 83 | $result[$k][$key] = $value; |
84 | - }else{ |
|
84 | + } else { |
|
85 | 85 | $result[$k][$k1] = $value; |
86 | 86 | } |
87 | 87 | } |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | if (1 === $dimension) { |
91 | 91 | foreach ($keys as $k1 => $key) { |
92 | 92 | $value = I::get($array, $key); |
93 | - if(is_numeric($k1)){ |
|
93 | + if (is_numeric($k1)) { |
|
94 | 94 | $result[$key] = $value; |
95 | - }else{ |
|
95 | + } else { |
|
96 | 96 | $result[$k1] = $value; |
97 | 97 | } |
98 | 98 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | public static function combine($keys, $values) |
160 | 160 | { |
161 | 161 | if (count($keys) == count($values)) { |
162 | - return (array) array_combine($keys, $values); |
|
162 | + return (array)array_combine($keys, $values); |
|
163 | 163 | } |
164 | 164 | $array = []; |
165 | 165 | foreach ($keys as $index => $key) { |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | } else { |
474 | 474 | $function = $callback; |
475 | 475 | if (false === is_callable($callback)) { |
476 | - $function = function ($row) use ($callback, $isStrict) { |
|
476 | + $function = function($row) use ($callback, $isStrict) { |
|
477 | 477 | return true === $isStrict ? $row === $callback : $row == $callback; |
478 | 478 | }; |
479 | 479 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $value = I::get($row, $key); |
82 | 82 | if(is_numeric($k1)){ |
83 | 83 | $result[$k][$key] = $value; |
84 | - }else{ |
|
84 | + } else{ |
|
85 | 85 | $result[$k][$k1] = $value; |
86 | 86 | } |
87 | 87 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $value = I::get($array, $key); |
93 | 93 | if(is_numeric($k1)){ |
94 | 94 | $result[$key] = $value; |
95 | - }else{ |
|
95 | + } else{ |
|
96 | 96 | $result[$k1] = $value; |
97 | 97 | } |
98 | 98 | } |