* @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL * @version CVS: $Id: Or.php,v 1.8 2005/04/21 10:01:47 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ require_once "File/Archive/Predicate.php"; /** * Evaluates to true iif one at least of the predicates * given as constructor parameters evaluate to true * * @see File_Archive_Predicate, File_Archive_Reader_Filter */ class File_Archive_Predicate_Or extends File_Archive_Predicate { /** * @var Array List of File_Archive_Predicate objects given as an argument * @access private */ var $preds; /** * Build the predicate using the optional File_Archive_Predicates given as * arguments * * Example: * new File_Archive_Predicate_And($pred1, $pred2, $pred3) */ function File_Archive_Predicate_And() { $this->preds = func_get_args(); } /** * Add a new predicate to the list * * @param File_Archive_Predicate The predicate to add */ function addPredicate($pred) { $this->preds[] = $pred; } /** * @see File_Archive_Predicate::isTrue() */ function isTrue(&$source) { foreach ($this->preds as $p) { if ($p->isTrue($source)) { return true; } } return false; } } ?>