Conditions | 3 |
Paths | 4 |
Total Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
15 | public function perform(FeedIo $feedIo, Feed $feed, Result $result): bool |
||
16 | { |
||
17 | $lastModifiedDates = []; |
||
18 | $result->setModifiedSince($feed->getLastModified()); |
||
19 | /** @var \FeedIo\Feed\ItemInterface $item */ |
||
20 | foreach ($feed as $i => $item) { |
||
21 | $lastModifiedDates[] = $item->getLastModified(); |
||
22 | } |
||
23 | sort($lastModifiedDates); |
||
24 | $first = current($lastModifiedDates); |
||
25 | $last = end($lastModifiedDates); |
||
26 | |||
27 | $result->setItemDates($lastModifiedDates); |
||
28 | if (!($last > $first)) { |
||
29 | $result->markAsFailed(Result::TEST_NORMAL_DATE_FLOW); |
||
30 | } |
||
31 | return true; |
||
32 | } |
||
33 | } |
||
34 |