Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3declare(strict_types=1);
4
5/**
6 * Fast Forward Development Tools for PHP projects.
7 *
8 * This file is part of fast-forward/dev-tools project.
9 *
10 * @author   Felipe SayĆ£o Lobato Abreu <github@mentordosnerds.com>
11 * @license  https://opensource.org/licenses/MIT MIT License
12 *
13 * @see      https://github.com/php-fast-forward/
14 * @see      https://github.com/php-fast-forward/dev-tools
15 * @see      https://github.com/php-fast-forward/dev-tools/issues
16 * @see      https://php-fast-forward.github.io/dev-tools/
17 * @see      https://datatracker.ietf.org/doc/html/rfc2119
18 */
19
20namespace FastForward\DevTools\GitAttributes;
21
22/**
23 * Defines the contract for writing .gitattributes files to persistent storage.
24 *
25 * Implementations MUST write the provided content to the target path, SHOULD
26 * normalize attribute-column alignment for deterministic output, and SHALL
27 * ensure the resulting file ends with a trailing line feed.
28 */
29interface WriterInterface
30{
31    /**
32     * Renders normalized .gitattributes content without persisting it.
33     *
34     * @param string $content the merged .gitattributes content to normalize
35     *
36     * @return string the normalized file content
37     */
38    public function render(string $content): string;
39
40    /**
41     * Writes the .gitattributes content to the specified filesystem path.
42     *
43     * @param string $gitattributesPath The filesystem path to the .gitattributes file.
44     * @param string $content The merged .gitattributes content to persist.
45     *
46     * @return void
47     */
48    public function write(string $gitattributesPath, string $content): void;
49}