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 | |
| 3 | declare(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 | |
| 20 | namespace FastForward\DevTools\GitIgnore; |
| 21 | |
| 22 | /** |
| 23 | * Defines the contract for writing .gitignore representations to persistent storage. |
| 24 | * |
| 25 | * Implementations MUST persist the entries exposed by a GitIgnoreInterface |
| 26 | * instance to its associated path. Implementations SHALL preserve the semantic |
| 27 | * ordering of entries provided by the input object and SHOULD write content in a |
| 28 | * format compatible with standard .gitignore files. |
| 29 | */ |
| 30 | interface WriterInterface |
| 31 | { |
| 32 | /** |
| 33 | * Renders the GitIgnore content without persisting it. |
| 34 | * |
| 35 | * @param GitIgnoreInterface $gitignore the .gitignore representation to render |
| 36 | * |
| 37 | * @return string the normalized .gitignore file content |
| 38 | */ |
| 39 | public function render(GitIgnoreInterface $gitignore): string; |
| 40 | |
| 41 | /** |
| 42 | * Writes the GitIgnore content to its associated filesystem path. |
| 43 | * |
| 44 | * The provided GitIgnoreInterface instance MUST contain the target path and |
| 45 | * the entries to be written. Implementations SHALL persist that content to |
| 46 | * the associated location represented by the given object. |
| 47 | * |
| 48 | * @param GitIgnoreInterface $gitignore The .gitignore representation to |
| 49 | * write to persistent storage. |
| 50 | * |
| 51 | * @return void |
| 52 | */ |
| 53 | public function write(GitIgnoreInterface $gitignore): void; |
| 54 | } |