xref: /PHP-7.2/ext/spl/examples/regexfindfile.inc (revision 60a69dae)
1<?php
2
3/** @file regexfindfile.inc
4 * @ingroup Examples
5 * @brief class RegexFindFile
6 * @author  Marcus Boerger
7 * @date    2003 - 2005
8 *
9 * SPL - Standard PHP Library
10 */
11
12/** @ingroup Examples
13 * @brief   Find files by regular expression
14 * @author  Marcus Boerger
15 * @version 1.1
16 *
17 */
18class RegexFindFile extends FindFile
19{
20	/** Construct from path and regular expression
21	 *
22	 * @param $path the directory to search in
23	 *              If path contains ';' then this parameter is split and every
24	 *              part of it is used as separate directory.
25	 * @param $regex perl style regular expression to find files with
26	 */
27	function __construct($path, $regex)
28	{
29		parent::__construct($path, $regex);
30	}
31
32	/** @return whether the current filename matches the regular expression.
33	 */
34	function accept()
35	{
36		return preg_match($this->getSearch(), $this->current());
37	}
38}
39
40?>
41