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 | * This file is part of fast-forward/dev-tools. |
| 7 | * |
| 8 | * This source file is subject to the license bundled |
| 9 | * with this source code in the file LICENSE. |
| 10 | * |
| 11 | * @copyright Copyright (c) 2026 Felipe Sayão Lobato Abreu <github@mentordosnerds.com> |
| 12 | * @license https://opensource.org/licenses/MIT MIT License |
| 13 | * |
| 14 | * @see https://github.com/php-fast-forward/dev-tools |
| 15 | * @see https://github.com/php-fast-forward |
| 16 | * @see https://datatracker.ietf.org/doc/html/rfc2119 |
| 17 | */ |
| 18 | |
| 19 | namespace FastForward\DevTools\GitIgnore; |
| 20 | |
| 21 | /** |
| 22 | * Defines the contract for classifying .gitignore entries. |
| 23 | * |
| 24 | * This classifier SHALL inspect a raw .gitignore entry and determine whether the |
| 25 | * entry expresses directory semantics or file semantics. Implementations MUST |
| 26 | * preserve deterministic classification for identical inputs. Blank entries and |
| 27 | * comment entries MUST be treated as file-oriented values to avoid incorrectly |
| 28 | * inferring directory intent where no effective pattern exists. |
| 29 | */ |
| 30 | interface ClassifierInterface |
| 31 | { |
| 32 | /** |
| 33 | * Classifies a .gitignore entry as directory or file pattern. |
| 34 | * |
| 35 | * @param string $entry the .gitignore entry to classify |
| 36 | * |
| 37 | * @return 'directory'|'file' the classification result |
| 38 | */ |
| 39 | public function classify(string $entry): string; |
| 40 | |
| 41 | /** |
| 42 | * Determines whether the entry represents a directory pattern. |
| 43 | * |
| 44 | * @param string $entry the .gitignore entry to check |
| 45 | * |
| 46 | * @return bool true if the entry is a directory pattern |
| 47 | */ |
| 48 | public function isDirectory(string $entry): bool; |
| 49 | |
| 50 | /** |
| 51 | * Determines whether the entry represents a file pattern. |
| 52 | * |
| 53 | * @param string $entry the .gitignore entry to check |
| 54 | * |
| 55 | * @return bool true if the entry is a file pattern |
| 56 | */ |
| 57 | public function isFile(string $entry): bool; |
| 58 | } |