Documentation

GitExcludeFilter extends BaseExcludeFilter
in package

An exclude filter that processes gitignore and gitattributes

It respects export-ignore git attributes

Tags
author

Nils Adermann naderman@naderman.de

Table of Contents

$excludePatterns  : array<string|int, mixed>
$sourcePath  : string
__construct()  : mixed
Parses .gitignore and .gitattributes files if they exist
filter()  : bool
Checks the given path against all exclude patterns in this filter
parseGitAttributesLine()  : array<string|int, mixed>|null
Callback parser which finds export-ignore rules in git attribute lines
parseGitIgnoreLine()  : array<string|int, mixed>
Callback line parser which process gitignore lines
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()

Parses .gitignore and .gitattributes files if they exist

public __construct(string $sourcePath) : mixed
Parameters
$sourcePath : string
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

parseGitAttributesLine()

Callback parser which finds export-ignore rules in git attribute lines

public parseGitAttributesLine(string $line) : array<string|int, mixed>|null
Parameters
$line : string

A line from .gitattributes

Return values
array<string|int, mixed>|null

An exclude pattern for filter()

parseGitIgnoreLine()

Callback line parser which process gitignore lines

public parseGitIgnoreLine(string $line) : array<string|int, mixed>
Parameters
$line : string

A line from .gitignore

Return values
array<string|int, mixed>

An exclude pattern for filter()

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