| Conditions | 2 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 19 | public function compose(View $view) |
||
| 20 | { |
||
| 21 | $client = new Client(); |
||
| 22 | try { |
||
| 23 | $response = $client->get('http://logger.witr.rit.edu/latest.json', [ |
||
| 24 | 'timeout' => 1, |
||
| 25 | ]); |
||
| 26 | return $view->with('nowplaying', $response->json(['object' => true])); |
||
| 27 | } catch (RequestException $e) { |
||
| 28 | $data = new stdClass; |
||
| 29 | $data->artist = ''; |
||
| 30 | $data->title = 'Not Available'; |
||
| 31 | return $view->with('nowplaying', $data); |
||
| 32 | } |
||
| 33 | } |
||
| 34 | } |