Documentation

FilecontentFilterIterator extends MultiplePcreFilterIterator
in package

FilecontentFilterIterator filters files by their contents using patterns (regexps or strings).

Tags
author

Fabien Potencier fabien@symfony.com

author

Włodzimierz Gajda gajdaw@gajdaw.pl

Table of Contents

$matchRegexps  : mixed
$noMatchRegexps  : mixed
__construct()  : mixed
accept()  : bool
Filters the iterator values.
isAccepted()  : bool
Checks whether the string is accepted by the regex filters.
isRegex()  : bool
Checks whether the string is a regex.
toRegex()  : string
Converts string to regexp if necessary.

Properties

Methods

__construct()

public __construct(Iterator $iterator, array<string|int, string> $matchPatterns, array<string|int, string> $noMatchPatterns) : mixed
Parameters
$iterator : Iterator

The Iterator to filter

$matchPatterns : array<string|int, string>

An array of patterns that need to match

$noMatchPatterns : array<string|int, string>

An array of patterns that need to not match

Return values
mixed

accept()

Filters the iterator values.

public accept() : bool
Return values
bool

true if the value should be kept, false otherwise

isAccepted()

Checks whether the string is accepted by the regex filters.

protected isAccepted(string $string) : bool

If there is no regexps defined in the class, this method will accept the string. Such case can be handled by child classes before calling the method if they want to apply a different behavior.

Parameters
$string : string
Return values
bool

isRegex()

Checks whether the string is a regex.

protected isRegex(string $str) : bool
Parameters
$str : string
Return values
bool

toRegex()

Converts string to regexp if necessary.

protected toRegex(string $str) : string
Parameters
$str : string

Pattern: string or regexp

Return values
string

regexp corresponding to a given string or regexp

Search results