/** * @param string $logDir * @param \DateTime|null $until * * @throws \InvalidArgumentException * * @return array */ public function collectDir($logDir, \DateTime $until = null) { $stat = []; /** @var $file \SplFileInfo */ foreach ($this->reader->readDir($logDir) as $file => $fileRows) { try { $stat[$file->getFilename()] = $this->collectFile($fileRows, $until); } catch (FormatException $e) { $stat[$file->getFilename()] = $e->getMessage(); } } return $stat; }
public function testEmptyFile() { $reader = new Reader(); $records = $reader->readFile($this->fileInfo('logs/emptyLog.log')); $this->assertCount(0, iterator_to_array($records)); }