Documentation

FilenameFilterIterator extends MultiplePcreFilterIterator
in package

FilenameFilterIterator filters files by patterns (a regexp, a glob, or a string).

Tags
author

Fabien Potencier fabien@symfony.com

Table of Contents

Properties

$matchRegexps  : mixed
$noMatchRegexps  : mixed

Methods

__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 glob to regexp.

Properties

Methods

__construct()

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

The Iterator to filter

$matchPatterns : array<string|int, mixed>

An array of patterns that need to match

$noMatchPatterns : array<string|int, mixed>

An array of patterns that need to not match

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

The string to be matched against filters

Return values
bool

isRegex()

Checks whether the string is a regex.

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

Whether the given string is a regex

toRegex()

Converts glob to regexp.

protected toRegex(string $str) : string

PCRE patterns are left unchanged. Glob strings are transformed with Glob::toRegex().

Parameters
$str : string

Pattern: glob or regexp

Return values
string

regexp corresponding to a given glob or regexp


        
On this page

Search results