| Conditions | 1 |
| Paths | 1 |
| Total Lines | 22 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 2 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | public function doFetchCurrent(Point $point) |
||
| 21 | { |
||
| 22 | $content = file_get_contents('http://api.openweathermap.org/data/2.5/weather?q=Ulyanovsk,%20RU&units=metric&lang=ru'); |
||
| 23 | |||
| 24 | $result = json_decode($content, true); |
||
| 25 | |||
| 26 | $cur = new Current(); |
||
| 27 | $cur->setData([ |
||
| 28 | 'summary' => $result['weather'][0]['description'], |
||
| 29 | 'temperature' => [ |
||
| 30 | 'current' => $result['main']['temp'], |
||
| 31 | 'min' => $result['main']['temp_min'], |
||
| 32 | 'max' => $result['main']['temp_max'], |
||
| 33 | ], |
||
| 34 | 'wind' => [ |
||
| 35 | 'speed' => $result['wind']['speed'], |
||
| 36 | 'degree' => $result['wind']['deg'], |
||
| 37 | ] |
||
| 38 | ]); |
||
| 39 | |||
| 40 | return $cur; |
||
| 41 | } |
||
| 42 | |||
| 86 |