Пример #1
0
 /**
  * Alias for scandir
  * @param integer $sorting_order
  * @return array
  */
 function scan($sorting_order = 0)
 {
     $scan = scandir($this->stream->getDirectory()->getPath(), $sorting_order);
     // removes . and ..
     array_shift($scan);
     array_shift($scan);
     return $scan;
 }
Пример #2
0
 /**
  * Recursively deletes folder contents
  * @return boolean|null
  */
 function delete()
 {
     if (!$this->exists()) {
         return;
     }
     $stream = new Directory\Stream($this);
     $reader = new Directory\Reader($stream);
     $stream->open();
     while ($info = $reader->read()) {
         if ($info instanceof File) {
             unlink($info->getPath());
         } elseif ($info instanceof Directory) {
             $info->delete();
         }
     }
     $stream->close();
     return $this->deleteEmpty();
 }