FindFile Class Reference
[Example classes]

Base class to find files. More...

Inheritance diagram for FindFile:

Inheritance graph
{RegexFindFile\n||+ __construct()\l+ accept()\l}
[legend]
List of all members.

Public Member Functions

 __construct ($path, $file)
 accept ()
 getSearch ()

Private Attributes

 $file

Detailed Description

Base class to find files.

Author:
Marcus Boerger
Version:
1.1

Definition at line 21 of file findfile.inc.


Constructor & Destructor Documentation

FindFile::__construct ( path,
file 
)

Construct from path and filename.

Parameters:
$path the directory to search in If path contains ';' then this parameter is split and every part of it is used as separate directory.
$file the name of the files to search fro

Reimplemented in RegexFindFile.

Definition at line 33 of file findfile.inc.

References $file, and $it.

00034     {
00035         $this->file = $file;
00036         $list = split(';', $path);
00037         if (count($list) <= 1) {
00038             parent::__construct(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)));
00039         } else {
00040             $it = new AppendIterator();
00041             foreach($list as $path) {
00042                 $it->append(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)));
00043             }
00044             parent::__construct($it);
00045         }
00046     }


Member Function Documentation

FindFile::accept (  ) 

Returns:
whether the current file matches the given filename

Reimplemented in RegexFindFile.

Definition at line 50 of file findfile.inc.

00051     {
00052         return !strcmp($this->current(), $this->file);
00053     }

FindFile::getSearch (  ) 

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.

Referenced by RegexFindFile::accept().

00060     {
00061         return $this->file;
00062     }


Member Data Documentation

FindFile::$file [private]

For internal use only.

filename to find

Definition at line 24 of file findfile.inc.

Referenced by __construct().


The documentation for this class was generated from the following file:
Generated on Thu Apr 26 01:05:49 2007 for SPL-StandardPHPLibrary by  doxygen 1.5.2