47 $path = realpath( $dir );
48 if (
$path ===
false ) {
51 $this->suffixStart = strlen(
$path ) + 1;
56 }
catch ( UnexpectedValueException $e ) {
68 if ( !empty( $this->params[
'topOnly'] ) ) {
69 # Get an iterator that will get direct sub-nodes
70 return new DirectoryIterator( $dir );
72 # Get an iterator that will return leaf nodes (non-directories)
73 # RecursiveDirectoryIterator extends FilesystemIterator.
74 # FilesystemIterator::SKIP_DOTS default is inconsistent in PHP 5.3.x.
75 $flags = FilesystemIterator::CURRENT_AS_SELF | FilesystemIterator::SKIP_DOTS;
77 return new RecursiveIteratorIterator(
78 new RecursiveDirectoryIterator( $dir, $flags ),
79 RecursiveIteratorIterator::CHILD_FIRST
88 public function key() {
97 return $this->
getRelPath( $this->iter->current()->getPathname() );
108 }
catch ( UnexpectedValueException $e ) {
109 throw new FileBackendError(
"File iterator gave UnexpectedValueException." );
121 $this->iter->rewind();
123 }
catch ( UnexpectedValueException $e ) {
124 throw new FileBackendError(
"File iterator gave UnexpectedValueException." );
133 return $this->iter && $this->iter->valid();
150 $path = realpath( $dir );
151 if (
$path ===
false ) {
155 return strtr( substr(
$path, $this->suffixStart ),
'\\',
'/' );