You are here

class SkipDotsRecursiveDirectoryIterator in Drupal 7

Provides an interface for iterating recursively over filesystem directories.

Manually skips '.' and '..' directories, since no existing method is available in PHP 5.2.

@todo Depreciate in favor of RecursiveDirectoryIterator::SKIP_DOTS once PHP 5.3 or later is required.

Hierarchy

Expanded class hierarchy of SkipDotsRecursiveDirectoryIterator

File

includes/filetransfer/filetransfer.inc, line 400

View source
class SkipDotsRecursiveDirectoryIterator extends RecursiveDirectoryIterator {

  /**
   * Constructs a SkipDotsRecursiveDirectoryIterator
   *
   * @param $path
   *   The path of the directory to be iterated over.
   */
  function __construct($path) {
    parent::__construct($path);
    $this
      ->skipdots();
  }
  function rewind() {
    parent::rewind();
    $this
      ->skipdots();
  }
  function next() {
    parent::next();
    $this
      ->skipdots();
  }
  protected function skipdots() {
    while ($this
      ->isDot()) {
      parent::next();
    }
  }

}

Members