public function testDirWithoutLogFiles() { $reader = new Reader(); $records = $reader->readDir($this->dir('withoutLogFilesDir')); $this->assertCount(0, iterator_to_array($records)); $records = $reader->readDir($this->dir('logs')); $this->assertGreaterThan(0, count(iterator_to_array($records, false))); }
/** * @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; }