| Conditions | 5 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 31 | public function getCurrent() |
||
| 32 | { |
||
| 33 | if (1 > $this->count()) { |
||
| 34 | return; |
||
| 35 | } |
||
| 36 | |||
| 37 | $current = null; |
||
| 38 | |||
| 39 | foreach ($this->all() as $schedule) { |
||
| 40 | if (empty($current) || $schedule->getDateInit() > $current->getDateInit()) { |
||
| 41 | $current = $schedule; |
||
| 42 | } |
||
| 43 | } |
||
| 44 | $convert = function ($int) { |
||
| 45 | return date('d-m-Y', ($int / 1000)); |
||
| 46 | }; |
||
| 47 | $current->setDateInit($convert($schedule->getDateInit())); |
||
|
|
|||
| 48 | $current->setDateEnd($convert($schedule->getDateEnd())); |
||
| 49 | |||
| 50 | return $current; |
||
| 51 | } |
||
| 52 | } |
||
| 53 |
It seems like you are relying on a variable being defined by an iteration: