mirror of
https://github.com/php/php-src.git
synced 2024-10-19 07:22:40 +00:00
a6feb3f405
- Update documentation - Move classes/interfaces already implemented in c to new subdir internal
50 lines
1.0 KiB
PHP
Executable File
50 lines
1.0 KiB
PHP
Executable File
<?php
|
|
|
|
/** \ingroup Examples
|
|
* @brief A filtered DirectoryIterator
|
|
* @author Marcus Boerger
|
|
* @version 1.0
|
|
*
|
|
* This Iteraotr takes a pathname from which it creates a DirectoryIterator
|
|
* and makes it recursive. Further more it filters the entries '.' and '..'.
|
|
*/
|
|
class DirectoryFilterDots extends FilterIterator implements RecursiveIterator
|
|
{
|
|
/** Construct from a path.
|
|
* @param $path directory to iterate
|
|
*/
|
|
function __construct($path)
|
|
{
|
|
parent::__construct(new DirectoryIterator($path));
|
|
}
|
|
|
|
/** @return whether the current entry is neither '.' nor '..'
|
|
*/
|
|
function accept()
|
|
{
|
|
return !$this->it->isDot();
|
|
}
|
|
|
|
/** @return whether the current entry is a directory
|
|
*/
|
|
function hasChildren()
|
|
{
|
|
return $this->it->hasChildren();
|
|
}
|
|
|
|
/** @return the current subdirectory as a new DirectoryFilterDots instance.
|
|
*/
|
|
function getChildren()
|
|
{
|
|
return new DirectoryFilterDots($this->it->getPathname());
|
|
}
|
|
|
|
/** @return the current entries path name
|
|
*/
|
|
function key()
|
|
{
|
|
return $this->it->getPathname();
|
|
}
|
|
}
|
|
|
|
?>
|