Documentation

BaseExcludeFilter
in package

Tags
author

Nils Adermann naderman@naderman.de

Table of Contents

$excludePatterns  : array<string|int, mixed>
$sourcePath  : string
__construct()  : mixed
filter()  : bool
Checks the given path against all exclude patterns in this filter
generatePattern()  : array<string|int, mixed>
Generates an exclude pattern for filter() from a gitignore rule
generatePatterns()  : array<string|int, mixed>
Generates a set of exclude patterns for filter() from gitignore rules
parseLines()  : array<string|int, mixed>
Processes a file containing exclude rules of different formats per line

Properties

Methods

__construct()

public __construct(string $sourcePath) : mixed
Parameters
$sourcePath : string

Directory containing sources to be filtered

Return values
mixed

filter()

Checks the given path against all exclude patterns in this filter

public filter(string $relativePath, bool $exclude) : bool

Negated patterns overwrite exclude decisions of previous filters.

Parameters
$relativePath : string

The file's path relative to the sourcePath

$exclude : bool

Whether a previous filter wants to exclude this file

Return values
bool

Whether the file should be excluded

generatePattern()

Generates an exclude pattern for filter() from a gitignore rule

protected generatePattern(string $rule) : array<string|int, mixed>
Parameters
$rule : string

An exclude rule in gitignore syntax

Return values
array<string|int, mixed>

An exclude pattern

generatePatterns()

Generates a set of exclude patterns for filter() from gitignore rules

protected generatePatterns(array<string|int, mixed> $rules) : array<string|int, mixed>
Parameters
$rules : array<string|int, mixed>

A list of exclude rules in gitignore syntax

Return values
array<string|int, mixed>

Exclude patterns

parseLines()

Processes a file containing exclude rules of different formats per line

protected parseLines(array<string|int, mixed> $lines, callable $lineParser) : array<string|int, mixed>
Parameters
$lines : array<string|int, mixed>

A set of lines to be parsed

$lineParser : callable

The parser to be used on each line

Return values
array<string|int, mixed>

Exclude patterns to be used in filter()

Search results