[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/tests_runner/src/ -> lmbTestFileFilter.class.php (source)

   1  <?php
   2  /*
   3   * Limb PHP Framework
   4   *
   5   * @link http://limb-project.com 
   6   * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
   7   * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
   8   */
   9  
  10  /**

  11   * class lmbTestFileFilter.

  12   *

  13   * @package tests_runner

  14   * @version $Id: lmbTestFileFilter.class.php 5945 2007-06-06 08:31:43Z pachanga $

  15   */
  16  class lmbTestFileFilter
  17  {
  18    protected $regex;
  19  
  20    function __construct($filters)
  21    {
  22      $this->regex = $this->_createRegex($filters);
  23    }
  24  
  25    function match($item)
  26    {
  27      return preg_match($this->regex, basename($item));
  28    }
  29  
  30    protected function _createRegex($filters)
  31    {
  32      $regex = implode('|', $filters);
  33      $regex = preg_quote($regex);
  34      $regex = str_replace(array('\*', '\|'), array('.*', '|'), $regex);
  35      return '~^(?:' . $regex. ')$~';
  36    }
  37  }
  38  
  39  ?>


Generated: Tue Dec 2 03:54:09 2008 Cross-referenced by PHPXref 0.7