1<?php
2/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
4/**
5 * Keep only the files which name follow a given case insensitive regular
6 * expression
7 *
8 * PHP versions 4 and 5
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA
23 *
24 * @category   File Formats
25 * @package    File_Archive
26 * @author     Vincent Lascaux <vincentlascaux@php.net>
27 * @copyright  1997-2005 The PHP Group
28 * @license    http://www.gnu.org/copyleft/lesser.html  LGPL
29 * @version    CVS: $Id: Eregi.php,v 1.6 2005/04/21 10:01:46 vincentlascaux Exp $
30 * @link       http://pear.php.net/package/File_Archive
31 */
32
33require_once "File/Archive/Predicate.php";
34
35/**
36 * Keep only the files which name follow a given case insensitive regular
37 * expression
38 *
39 * @see        File_Archive_Predicate, File_Archive_Reader_Filter eregi
40 */
41class File_Archive_Predicate_Eregi extends File_Archive_Predicate
42{
43    var $ereg;
44
45    /**
46     * @param string $ereg is the regular expression
47     */
48    function File_Archive_Predicate_Eregi($ereg)
49    {
50        $this->ereg = $ereg;
51    }
52    /**
53     * @see File_Archive_Predicate::isTrue()
54     */
55    function isTrue(&$source)
56    {
57        return eregi($this->ereg, $source->getFilename());
58    }
59}
60
61?>