/** * Gives the table name * * @return string */ public function getName() { $name = $this->dir->getPath(); $name = explode(DIRECTORY_SEPARATOR, $name); $name = $name[count($name) - 1]; return $name; }
/** * Remove directory * * @param boolean $recursive (empty directory contents and remove) * @return boolean */ public function remove($recursive = false) { if (!$this->__isDir()) { return false; } if (!$recursive) { if (!@rmdir($this->_path)) { $this->error = parent::_getLastError(); return false; } return true; } // recursive remove foreach ($this->read(false, true) as $asset) { if ($asset['type'] === 'dir') { $dir = new Directory($this->_path . $asset['name'], false); if (!$dir->remove(true)) { $this->error = 'Failed to remove subdirectory \'' . $dir->getPath() . '\' (' . $dir->error . '), try elevated chmod'; return false; } } else { $file = new File($this->_path . $asset['name'], false); if (!$file->remove()) { $this->error = 'Failed to remove file \'' . $file->getPath() . '\' (' . $file->error . '), try elevated chmod'; return false; } } } return $this->remove(); // finally remove base directory }
/** * @return string The full path to this file. */ public function getPath() { return $this->directory->getPath($this->path); }
public function moveInto($destination, $overwrite = false) { $dir = new Directory($destination, true); $this->move($dir->getPath() . DS . $this->getName(), $overwrite); }
/** * * @param \Documentor\Directory $directory * * @return Project */ public function add(Directory $directory) { $this->directories[$directory->getPath()] = $directory; return $this; }
/** * @param Directory $directory */ public function addDirectory(Directory $directory) { $this->directories[$directory->getPath()] = $directory; }