Overview

Namespaces

  • Contrib
    • Bundle
      • CoverallsBundle
        • Console
        • Entity
      • CoverallsV1Bundle
        • Api
        • Collector
        • Command
        • Config
        • Entity
          • Git
    • Component
      • File
      • Log
      • System
        • Git
  • Guzzle
    • Batch
      • Exception
    • Cache
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
      • QueryAggregator
    • Inflection
    • Iterator
    • Log
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Async
      • Backoff
      • Cache
      • Cookie
        • CookieJar
        • Exception
      • CurlAuth
      • ErrorResponse
        • Exception
      • History
      • Log
      • Md5
      • Mock
      • Oauth
    • Service
      • Builder
      • Command
        • Factory
        • LocationVisitor
          • Request
          • Response
      • Description
      • Exception
      • Resource
    • Stream
  • PHP
  • Psr
    • Log
  • Symfony
    • Component
      • Config
        • Definition
          • Builder
          • Exception
        • Exception
        • Loader
        • Resource
        • Util
      • Console
        • Command
        • Formatter
        • Helper
        • Input
        • Output
        • Tester
      • EventDispatcher
        • Debug
      • Finder
        • Adapter
        • Comparator
        • Exception
        • Expression
        • Iterator
        • Shell
      • Stopwatch
      • Yaml
        • Exception

Classes

  • CustomFilterIterator
  • DateRangeFilterIterator
  • DepthRangeFilterIterator
  • ExcludeDirectoryFilterIterator
  • FilecontentFilterIterator
  • FilenameFilterIterator
  • FilePathsIterator
  • FileTypeFilterIterator
  • FilterIterator
  • MultiplePcreFilterIterator
  • PathFilterIterator
  • RecursiveDirectoryIterator
  • SizeRangeFilterIterator
  • SortableIterator
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo
 1: <?php
 2: 
 3: /*
 4:  * This file is part of the Symfony package.
 5:  *
 6:  * (c) Fabien Potencier <fabien@symfony.com>
 7:  *
 8:  * For the full copyright and license information, please view the LICENSE
 9:  * file that was distributed with this source code.
10:  */
11: 
12: namespace Symfony\Component\Finder\Iterator;
13: 
14: use Symfony\Component\Finder\Expression\Expression;
15: 
16: /**
17:  * MultiplePcreFilterIterator filters files using patterns (regexps, globs or strings).
18:  *
19:  * @author Fabien Potencier <fabien@symfony.com>
20:  */
21: abstract class MultiplePcreFilterIterator extends FilterIterator
22: {
23:     protected $matchRegexps;
24:     protected $noMatchRegexps;
25: 
26:     /**
27:      * Constructor.
28:      *
29:      * @param \Iterator $iterator        The Iterator to filter
30:      * @param array     $matchPatterns   An array of patterns that need to match
31:      * @param array     $noMatchPatterns An array of patterns that need to not match
32:      */
33:     public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
34:     {
35:         $this->matchRegexps = array();
36:         foreach ($matchPatterns as $pattern) {
37:             $this->matchRegexps[] = $this->toRegex($pattern);
38:         }
39: 
40:         $this->noMatchRegexps = array();
41:         foreach ($noMatchPatterns as $pattern) {
42:             $this->noMatchRegexps[] = $this->toRegex($pattern);
43:         }
44: 
45:         parent::__construct($iterator);
46:     }
47: 
48:     /**
49:      * Checks whether the string is a regex.
50:      *
51:      * @param string $str
52:      *
53:      * @return Boolean Whether the given string is a regex
54:      */
55:     protected function isRegex($str)
56:     {
57:         return Expression::create($str)->isRegex();
58:     }
59: 
60:     /**
61:      * Converts string into regexp.
62:      *
63:      * @param string $str Pattern
64:      *
65:      * @return string regexp corresponding to a given string
66:      */
67:     abstract protected function toRegex($str);
68: }
69: 
php-coveralls API documentation generated by ApiGen 2.8.0