private getEntryIterator ( ) : ArrayIterator | ||
return | ArrayIterator |
private function getEntryIterator()
{
$files = $this->days->current();
$files = new \DirectoryIterator($this->days->current());
$historyEntries = [];
foreach ($files as $file) {
if (!$file->isFile()) {
continue;
}
if ($file->getExtension() !== 'xml') {
continue;
}
$historyEntries[] = $this->getHistoryEntry($file->getPathname());
}
usort($historyEntries, function ($entry1, $entry2) {
if ($entry1->getDate()->format('U') === $entry2->getDate()->format('U')) {
return;
}
return $entry1->getDate()->format('U') < $entry2->getDate()->format('U');
});
return new \ArrayIterator($historyEntries);
}