You are here

public function File_Iterator::accept in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/php-file-iterator/src/Iterator.php \File_Iterator::accept()

Return value

bool

File

vendor/phpunit/php-file-iterator/src/Iterator.php, line 76

Class

File_Iterator
FilterIterator implementation that filters files based on prefix(es) and/or suffix(es). Hidden files and files from hidden directories are also filtered.

Code

public function accept() {
  $current = $this
    ->getInnerIterator()
    ->current();
  $filename = $current
    ->getFilename();
  $realpath = $current
    ->getRealPath();
  if ($this->basepath !== NULL) {
    $realpath = str_replace($this->basepath, '', $realpath);
  }

  // Filter files in hidden directories.
  if (preg_match('=/\\.[^/]*/=', $realpath)) {
    return FALSE;
  }
  return $this
    ->acceptPath($realpath) && $this
    ->acceptPrefix($filename) && $this
    ->acceptSuffix($filename);
}