| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | <?php namespace WITR\Http\Controllers; |
||
| 26 | private function getNextGame($parser) |
||
| 27 | { |
||
| 28 | $reader = Reader::forParser($parser); |
||
| 29 | $games = $reader->get()->sortBy(function($game) { |
||
| 30 | return $game->startUtc->timestamp; |
||
| 31 | }); |
||
| 32 | $laterGames = $games->filter(function ($game) { |
||
| 33 | return $game->startUtc > Carbon::now('UTC'); |
||
| 34 | }); |
||
| 35 | |||
| 36 | if ($laterGames->isEmpty()) |
||
| 37 | { |
||
| 38 | return $games->last(); |
||
| 39 | } |
||
| 40 | |||
| 41 | return $laterGames->first(); |
||
| 42 | } |
||
| 43 | } |
||
| 44 |