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