fileReadFactory = $readFactory; $this->paths = $paths; $this->position = 0; } /** * Rewind * * @return void */ public function rewind() { reset($this->paths); } /** * Current * * @return string */ public function current() { $fileRead = $this->fileReadFactory->create($this->key(), DriverPool::FILE); return $fileRead->readAll(); } /** * Key * * @return mixed */ public function key() { return current($this->paths); } /** * Next * * @return void */ public function next() { next($this->paths); } /** * Valid * * @return bool */ public function valid() { return (bool) $this->key(); } /** * Convert to an array * * @return array */ public function toArray() { $result = []; foreach ($this as $item) { $result[$this->key()] = $item; } return $result; } /** * Count * * @return int */ public function count() { return count($this->paths); } }