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

Public Member Functions

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

Protected Member Functions

 __clone ()
 
 fetch ()
 

Detailed Description

Find files by regular expression.

Author
Marcus Boerger
Version
1.1

Definition at line 18 of file regexfindfile.inc.

Constructor & Destructor Documentation

RegexFindFile::__construct (   $path,
  $regex 
)

Construct from path and regular expression.

Parameters
$paththe directory to search in If path contains ';' then this parameter is split and every part of it is used as separate directory.
$regexperl style regular expression to find files with

Definition at line 27 of file regexfindfile.inc.

28  {
29  parent::__construct($path, $regex);
30  }

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  }
RegexFindFile::accept ( )
Returns
whether the current filename matches the regular expression.

Definition at line 34 of file regexfindfile.inc.

References FilterIterator\current(), and FindFile\getSearch().

35  {
36  return preg_match($this->getSearch(), $this->current());
37  }
getSearch()
Definition: findfile.inc:59

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 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:

FilterIterator::getInnerIterator ( )
inherited
FindFile::getSearch ( )
inherited
Returns
the filename to search for.
Note
This may be overloaded and contain a regular expression for an extended class that uses regular expressions to search.

Definition at line 59 of file findfile.inc.

References FindFile\$file.

Referenced by accept().

60  {
61  return $this->file;
62  }
FilterIterator::key ( )
inherited
Returns
The current key

Implements Iterator.

Definition at line 90 of file filteriterator.inc.

Referenced by KeyFilter\accept().

90  {
91  return $this->it->key();
92  }
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: