_opendir = @opendir( $directory ) ) ) throw new VanishedException(sprintf("The directory %s has vanished", $directory)); $this->_path = $directory; $this->_source = $source; $this->_size = 0; } /** * @return ScanFile|null */ public function next() { if(($next = readdir($this->_opendir)) === false) return null; if($next == '.' || $next == '..') return $this->next(); try { return new ScanFile($this->_path, $next, $this->_source); } catch(ArchiveException $ex ) { return null; } } /** * @return ScanFile * @throws ArchiveException */ public function getDetails() { return new ScanFile(dirname($this->_path), basename($this->_path), $this->_source); } public function addSize($size) { $this->_size += (int) $size; if($this->_parent) $this->_parent->addSize($size); } public function getSize() { return $this->_size; } public function getPath() { return $this->_path; } public function setParent(Scan $parent) { $this->_parent = $parent; } public function getParent() { return $this->_parent; } public function __destruct() { closedir($this->_opendir); } }