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\GitAttributes; |
| 20 | |
| 21 | /** |
| 22 | * Checks the existence of files and directories in a given base path. |
| 23 | * |
| 24 | * This interface defines the contract for determining which candidate |
| 25 | * paths actually exist in the target repository. |
| 26 | */ |
| 27 | interface ExistenceCheckerInterface |
| 28 | { |
| 29 | /** |
| 30 | * Checks if a path exists as a file or directory. |
| 31 | * |
| 32 | * @param string $basePath the repository base path used to resolve the candidate |
| 33 | * @param string $path The path to check (e.g., "/.github/" or "/.editorconfig") |
| 34 | * |
| 35 | * @return bool True if the path exists as a file or directory |
| 36 | */ |
| 37 | public function exists(string $basePath, string $path): bool; |
| 38 | |
| 39 | /** |
| 40 | * Filters a list of paths to only those that exist. |
| 41 | * |
| 42 | * @param string $basePath the repository base path used to resolve the candidates |
| 43 | * @param list<string> $paths The paths to filter |
| 44 | * |
| 45 | * @return list<string> Only the paths that exist |
| 46 | */ |
| 47 | public function filterExisting(string $basePath, array $paths): array; |
| 48 | |
| 49 | /** |
| 50 | * Checks if a path is a directory. |
| 51 | * |
| 52 | * @param string $basePath the repository base path used to resolve the candidate |
| 53 | * @param string $path The path to check (e.g., "/.github/") |
| 54 | * |
| 55 | * @return bool True if the path exists and is a directory |
| 56 | */ |
| 57 | public function isDirectory(string $basePath, string $path): bool; |
| 58 | |
| 59 | /** |
| 60 | * Checks if a path is a file. |
| 61 | * |
| 62 | * @param string $basePath the repository base path used to resolve the candidate |
| 63 | * @param string $path The path to check (e.g., "/.editorconfig") |
| 64 | * |
| 65 | * @return bool True if the path exists and is a file |
| 66 | */ |
| 67 | public function isFile(string $basePath, string $path): bool; |
| 68 | } |