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\License; |
| 20 | |
| 21 | /** |
| 22 | * Generates LICENSE files from composer.json metadata. |
| 23 | * |
| 24 | * This interface defines the contract for generating license files |
| 25 | * by reading composer.json and producing appropriate license content. |
| 26 | */ |
| 27 | interface GeneratorInterface |
| 28 | { |
| 29 | /** |
| 30 | * Generates a LICENSE file at the specified path. |
| 31 | * |
| 32 | * Reads the license from composer.json, validates it's supported, |
| 33 | * loads the appropriate template, resolves placeholders, and writes |
| 34 | * the LICENSE file to the target path. |
| 35 | * |
| 36 | * @param string $targetPath The full path where the LICENSE file should be written |
| 37 | * |
| 38 | * @return string|null The generated license content, or null if generation failed |
| 39 | */ |
| 40 | public function generate(string $targetPath): ?string; |
| 41 | |
| 42 | /** |
| 43 | * Checks whether a supported license is present in composer.json. |
| 44 | * |
| 45 | * @return bool True if a supported license is defined, false otherwise |
| 46 | */ |
| 47 | public function hasLicense(): bool; |
| 48 | } |