-
-
Notifications
You must be signed in to change notification settings - Fork 0
Generator
github-actions edited this page Apr 19, 2026
·
1 revision
Generates LICENSE files from composer.json metadata.
This class orchestrates the license generation workflow:
- Reads metadata from composer.json via Reader
- Resolves the license identifier to a template filename
- Uses the central Template Engine and VariablesFactory to map out the substitutions
- Writes the resulting LICENSE file to the target path
Generation is skipped if a LICENSE file already exists or if the license is not supported.
- Full name:
\FastForward\DevTools\License\Generator - This class is marked as final and can't be subclassed
- This class implements:
\FastForward\DevTools\License\GeneratorInterface - This class is a Final class
Creates a new Generator instance.
public __construct(\FastForward\DevTools\License\ResolverInterface $resolver, \FastForward\DevTools\Composer\Json\ComposerJsonInterface $composer, \Psr\Clock\ClockInterface $clock, \Twig\Environment $renderer, \FastForward\DevTools\Filesystem\FilesystemInterface $filesystem): mixedParameters:
| Parameter | Type | Description |
|---|---|---|
$resolver |
\FastForward\DevTools\License\ResolverInterface | The resolver for mapping license identifiers to templates |
$composer |
\FastForward\DevTools\Composer\Json\ComposerJsonInterface | |
$clock |
\Psr\Clock\ClockInterface | |
$renderer |
\Twig\Environment | |
$filesystem |
\FastForward\DevTools\Filesystem\FilesystemInterface | The filesystem component for file operations |
Generates a LICENSE file at the specified path.
public generate(string $targetPath): string|nullParameters:
| Parameter | Type | Description |
|---|---|---|
$targetPath |
string | The full path where the LICENSE file should be written |
Return Value:
The generated license content, or null if generation failed
Generates license content without writing it to disk.
public generateContent(): string|nullReturn Value:
the generated license content, or null if generation failed