Composer API
Class

Composer\Package\Archiver\GitExcludeFilter

class GitExcludeFilter extends BaseExcludeFilter

An exclude filter that processes gitignore and gitattributes

It respects export-ignore git attributes

Methods

__construct(string $sourcePath)

Parses .gitignore and .gitattributes files if they exist

bool filter(string $relativePath, bool $exclude)

Checks the given path against all exclude patterns in this filter

from BaseExcludeFilter
array parseGitIgnoreLine(string $line)

Callback line parser which process gitignore lines

array parseGitAttributesLine(string $line)

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

Details

at line 29
public __construct(string $sourcePath)

Parses .gitignore and .gitattributes files if they exist

Parameters

string $sourcePath Directory containing sources to be filtered

in BaseExcludeFilter at line 51
public 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

at line 56
public array parseGitIgnoreLine(string $line)

Callback line parser which process gitignore lines

Parameters

string $line A line from .gitignore

Return Value

array An exclude pattern for filter()

at line 68
public array parseGitAttributesLine(string $line)

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

Parameters

string $line A line from .gitattributes

Return Value

array An exclude pattern for filter()