abstract class BaseExcludeFilter (View source)

Properties

protected string $sourcePath
protected array $excludePatterns

Methods

__construct(string $sourcePath)

No description

bool
filter(string $relativePath, bool $exclude)

Checks the given path against all exclude patterns in this filter

array
parseLines(array $lines, callable $lineParser)

Processes a file containing exclude rules of different formats per line

array
generatePatterns(array $rules)

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

array
generatePattern(string $rule)

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

Details

__construct(string $sourcePath)

Parameters

string $sourcePath Directory containing sources to be filtered

bool filter(string $relativePath, bool $exclude)

Checks the given path against all exclude patterns in this filter

Negated patterns overwrite exclude decisions of previous filters.

Parameters

string $relativePath The file's path relative to the sourcePath
bool $exclude Whether a previous filter wants to exclude this file

Return Value

bool Whether the file should be excluded

protected array parseLines(array $lines, callable $lineParser)

Processes a file containing exclude rules of different formats per line

Parameters

array $lines A set of lines to be parsed
callable $lineParser The parser to be used on each line

Return Value

array Exclude patterns to be used in filter()

protected array generatePatterns(array $rules)

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

Parameters

array $rules A list of exclude rules in gitignore syntax

Return Value

array Exclude patterns

protected array generatePattern(string $rule)

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

Parameters

string $rule An exclude rule in gitignore syntax

Return Value

array An exclude pattern