Example #1
0
 protected static function deleteDirStatic($name = "")
 {
     $self = new self();
     if ($self->isDir($name)) {
         return rmdir($self->storagePath . "/" . $name);
     } else {
         throw new \InvalidArgumentException("There is no directory calls {$name}");
     }
 }
Example #2
0
File: File.php Project: rsms/phpab
 /**
  * @param  File[]
  * @param  string
  * @param  bool
  * @return void
  * @throws IOException
  */
 private function getFilesR(&$files, $dir)
 {
     $dir = rtrim($dir, '/');
     if (!($dh = @opendir($dir))) {
         throw new IOException('Failed to open directory for reading: ' . $dir);
     }
     try {
         while (($file = readdir($dh)) !== false) {
             if ($file != '.' && $file != '..') {
                 $f = new self($dir . '/' . $file);
                 $files[] = $f;
                 if ($f->isDir()) {
                     $this->getFilesR($files, $f->toString());
                 }
             }
         }
         closedir($dh);
     } catch (Exception $e) {
         closedir($dh);
         throw $e;
     }
 }