You are here

public function RecursiveDirectoryIterator::getChildren in Database Sanitize 7

Return value

\RecursiveIterator

Throws

AccessDeniedException

Overrides RecursiveDirectoryIterator::getChildren

1 method overrides RecursiveDirectoryIterator::getChildren()
RecursiveDirectoryIterator::getChildren in vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php

File

vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php, line 85

Class

RecursiveDirectoryIterator
Extends the \RecursiveDirectoryIterator to support relative paths.

Namespace

Symfony\Component\Finder\Iterator

Code

public function getChildren() {
  try {
    $children = parent::getChildren();
    if ($children instanceof self) {

      // parent method will call the constructor with default arguments, so unreadable dirs won't be ignored anymore
      $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;

      // performance optimization to avoid redoing the same work in all children
      $children->rewindable =& $this->rewindable;
      $children->rootPath = $this->rootPath;
    }
    return $children;
  } catch (\UnexpectedValueException $e) {
    if ($this->ignoreUnreadableDirs) {

      // If directory is unreadable and finder is set to ignore it, a fake empty content is returned.
      return new \RecursiveArrayIterator(array());
    }
    else {
      throw new AccessDeniedException($e
        ->getMessage(), $e
        ->getCode(), $e);
    }
  }
}