-
-
Notifications
You must be signed in to change notification settings - Fork 0
GitIgnore
Represents a .gitignore file with its path and entries.
This class implements IteratorAggregate to allow iteration over entries and provides a factory method to load .gitignore content from the file system.
- Full name:
\FastForward\DevTools\GitIgnore\GitIgnore - This class is marked as final and can't be subclassed
- This class implements:
\FastForward\DevTools\GitIgnore\GitIgnoreInterface - This class is a Final class
public string $pathpublic array $entriesInitializes a GitIgnore instance with the given path and entries.
public __construct(string $path, list<string> $entries): mixedParameters:
| Parameter | Type | Description |
|---|---|---|
$path |
string | the file system path to the .gitignore file |
$entries |
list | the .gitignore entries |
Returns the file system path to the .gitignore file.
public path(): stringReturn Value:
the absolute path to the .gitignore file
Returns the list of entries from the .gitignore file.
public entries(): list<string>Return Value:
the non-empty .gitignore entries
Returns an iterator over the .gitignore entries.
public getIterator(): \ArrayIterator<int,string>This method implements the IteratorAggregate interface.
Return Value:
an iterator over the entries
Creates a GitIgnore instance from a file path.
public static fromFile(string $gitignorePath): staticIf the file does not exist, returns an empty GitIgnore with the given path. Empty lines and whitespace-only lines are filtered from the entries.
- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$gitignorePath |
string | the file system path to the .gitignore file |
Return Value:
a new GitIgnore instance