SPL-StandardPHPLibrary
Public Member Functions | Protected Member Functions | List of all members
DirectoryFilterDots Class Reference
Inheritance diagram for DirectoryFilterDots:
Inheritance graph
Collaboration diagram for DirectoryFilterDots:
Collaboration graph

Public Member Functions

 __call ($func, $params)
 
 __construct ($path)
 
 accept ()
 
 current ()
 
 getChildren ()
 
 getInnerIterator ()
 
 hasChildren ()
 
 key ()
 
 next ()
 
 rewind ()
 
 valid ()
 

Protected Member Functions

 __clone ()
 
 fetch ()
 

Detailed Description

A filtered DirectoryIterator.

Author
Marcus Boerger
Version
1.2

This Iterator takes a pathname from which it creates a RecursiveDirectoryIterator and makes it recursive. Further more it filters the entries '.' and '..'.

Definition at line 20 of file directoryfilterdots.inc.

Constructor & Destructor Documentation

DirectoryFilterDots::__construct (   $path)

Construct from a path.

Parameters
$pathdirectory to iterate

Definition at line 25 of file directoryfilterdots.inc.

26  {
27  parent::__construct(new RecursiveDirectoryIterator($path));
28  }
recursive directory iterator
Definition: spl.php:1034

Member Function Documentation

FilterIterator::__call (   $func,
  $params 
)
inherited

Aggregate the inner iterator.

Parameters
funcName of method to invoke
paramsArray of parameters to pass to method

Definition at line 121 of file filteriterator.inc.

122  {
123  return call_user_func_array(array($this->it, $func), $params);
124  }
FilterIterator::__clone ( )
protectedinherited

hidden __clone

Definition at line 104 of file filteriterator.inc.

104  {
105  // disallow clone
106  }
DirectoryFilterDots::accept ( )
Returns
whether the current entry is neither '.' nor '..'

Definition at line 32 of file directoryfilterdots.inc.

References FilterIterator\getInnerIterator().

33  {
34  return !$this->getInnerIterator()->isDot();
35  }

Here is the call graph for this function:

FilterIterator::current ( )
inherited
Returns
The current value

Implements Iterator.

Definition at line 97 of file filteriterator.inc.

Referenced by RegexFindFile\accept(), and FindFile\accept().

97  {
98  return $this->it->current();
99  }
FilterIterator::fetch ( )
protectedinherited

Fetch next element and store it.

Returns
void

Definition at line 61 of file filteriterator.inc.

References FilterIterator\accept().

Referenced by FilterIterator\next(), and FilterIterator\rewind().

61  {
62  while ($this->it->valid()) {
63  if ($this->accept()) {
64  return;
65  }
66  $this->it->next();
67  };
68  }
accept()
Accept function to decide whether an element of the inner iterator should be accessible through the F...

Here is the call graph for this function:

RecursiveFilterIterator::getChildren ( )
inherited
Returns
an iterator for the current elements children
Note
the returned iterator will be of the same class as $this

Implements RecursiveIterator.

Definition at line 50 of file recursivefilteriterator.inc.

References FilterIterator\getInnerIterator().

51  {
52  if (empty($this->ref))
53  {
54  $this->ref = new ReflectionClass($this);
55  }
56  return $this->ref->newInstance($this->getInnerIterator()->getChildren());
57  }

Here is the call graph for this function:

FilterIterator::getInnerIterator ( )
inherited
RecursiveFilterIterator::hasChildren ( )
inherited
Returns
whether the current element has children

Implements RecursiveIterator.

Definition at line 41 of file recursivefilteriterator.inc.

References FilterIterator\getInnerIterator().

42  {
43  return $this->getInnerIterator()->hasChildren();
44  }

Here is the call graph for this function:

DirectoryFilterDots::key ( )
Returns
the current entries path name

Implements Iterator.

Definition at line 39 of file directoryfilterdots.inc.

References FilterIterator\getInnerIterator().

40  {
41  return $this->getInnerIterator()->getPathname();
42  }

Here is the call graph for this function:

FilterIterator::next ( )
inherited

Move to next element.

Returns
void

Implements Iterator.

Definition at line 75 of file filteriterator.inc.

References FilterIterator\fetch().

75  {
76  $this->it->next();
77  $this->fetch();
78  }
fetch()
Fetch next element and store it.

Here is the call graph for this function:

FilterIterator::rewind ( )
inherited

Rewind the inner iterator.

Implements Iterator.

Definition at line 42 of file filteriterator.inc.

References FilterIterator\fetch().

42  {
43  $this->it->rewind();
44  $this->fetch();
45  }
fetch()
Fetch next element and store it.

Here is the call graph for this function:

FilterIterator::valid ( )
inherited
Returns
Whether more elements are available

Implements Iterator.

Definition at line 83 of file filteriterator.inc.

83  {
84  return $this->it->valid();
85  }

The documentation for this class was generated from the following file: