Documentation

Horde_Pear_Package_Contents_PatternsMatcher
in package

This class helps with matching file paths against search patterns.

Tags
author

Gunnar Wrobel wrobel@pardus.de

author

Jan Schneider jan@horde.org

category

Horde

copyright

2011-2017 Horde LLC

license

http://www.horde.org/licenses/lgpl21 LGPL 2.1

Table of Contents

$_patterns  : array<string|int, mixed>
The regular expression patterns.
__construct()  : mixed
Constructor.
matches()  : bool
Does the given path match one of the regular expression patterns?
_getRegExpableSearchString()  : string
Converts $s into a string that can be used with preg_match.
_prepare()  : mixed
Prepares the list of patterns from the input.

Properties

$_patterns

The regular expression patterns.

protected array<string|int, mixed> $_patterns = array()

Methods

__construct()

Constructor.

public __construct(array<string|int, mixed> $patterns) : mixed
Parameters
$patterns : array<string|int, mixed>

The patterns.

Return values
mixed

matches()

Does the given path match one of the regular expression patterns?

public matches(string $path) : bool
Parameters
$path : string

The file path.

Return values
bool

True if one of the pattern matches.

_getRegExpableSearchString()

Converts $s into a string that can be used with preg_match.

protected _getRegExpableSearchString(string $s) : string
Parameters
$s : string

String with wildcards ? and *.

Return values
string

Search string converted * to .*, ? to ., etc.

_prepare()

Prepares the list of patterns from the input.

protected _prepare(string $patterns) : mixed
Parameters
$patterns : string

The patterns.

Return values
mixed

Search results