Persists normalized .gitattributes content.
Description
This writer SHALL align attribute declarations using the longest path spec, write the provided textual content to the target path, and MUST append a final trailing line feed for deterministic formatting.
Interfaces
Properties
Methods
Writes the .gitattributes content to the specified filesystem path.
Locates the first non-escaped whitespace separator in a line.
Formats .gitattributes content with aligned attribute columns.
Parses a .gitattributes entry into its path spec and attribute segment.
public
__construct(Filesystem
$filesystem) : mixed
Parameters
$filesystem
:
Filesystem
Description
the filesystem service responsible for writing the file
Writes the .gitattributes content to the specified filesystem path.
public
write(
string
$gitattributesPath,
string
$content) : void
Parameters
$gitattributesPath
:
string
Description
The filesystem path to the .gitattributes file.
$content
:
string
Description
The merged .gitattributes content to persist.
Locates the first non-escaped whitespace separator in a line.
private
firstUnescapedWhitespacePosition(
string
$line) : int|null
Parameters
$line
:
string
Description
the line to inspect
Return values
Formats .gitattributes content with aligned attribute columns.
private
format(
string
$content) : string
Parameters
$content
:
string
Description
The merged .gitattributes content to normalize.
Return values
Parses a .gitattributes entry into its path spec and attribute segment.
private
parseEntry(
string
$line) : array{path_spec: string, attributes: string}|null
Parameters
$line
:
string
Description
The normalized .gitattributes line.