php-src/ext/spl/examples/directoryfilterdots.inc

46 lines
959 B
PHP
Raw Normal View History

<?php
/** @file directoryfilterdots.inc
* @ingroup Examples
* @brief class DirectoryFilterDots
* @author Marcus Boerger
2006-11-03 18:58:41 +00:00
* @date 2003 - 2006
*
* SPL - Standard PHP Library
*/
/** @ingroup Examples
* @brief A filtered DirectoryIterator
* @author Marcus Boerger
2006-11-03 18:58:41 +00:00
* @version 1.2
*
2007-01-22 08:36:21 +00:00
* This Iterator takes a pathname from which it creates a RecursiveDirectoryIterator
* and makes it recursive. Further more it filters the entries '.' and '..'.
*/
2004-11-01 00:33:41 +00:00
class DirectoryFilterDots extends RecursiveFilterIterator
{
/** Construct from a path.
* @param $path directory to iterate
*/
function __construct($path)
{
2006-11-03 18:58:41 +00:00
parent::__construct(new RecursiveDirectoryIterator($path));
}
/** @return whether the current entry is neither '.' nor '..'
*/
function accept()
{
return !$this->getInnerIterator()->isDot();
}
/** @return the current entries path name
*/
function key()
{
return $this->getInnerIterator()->getPathname();
}
}
2007-01-22 08:36:21 +00:00
?>