Conditions | 3 |
Paths | 1 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
33 | 2 | private function findLatestDateTimeFromNews(Quote $quote): string |
|
34 | { |
||
35 | 2 | $reduced = array_reduce( |
|
36 | 2 | $quote->getLatestNews(), |
|
37 | 2 | static function (?News $carry, News $current): News { |
|
38 | 2 | if (null === $carry) { |
|
39 | 2 | return $current; |
|
40 | } |
||
41 | |||
42 | 2 | return $carry->getDatetime() > $current->getDatetime() |
|
43 | 1 | ? $carry |
|
44 | 2 | : $current; |
|
45 | 2 | } |
|
46 | ); |
||
47 | |||
48 | 2 | return $reduced->getDatetime() ?? ''; |
|
49 | } |
||
51 |