-
-
Notifications
You must be signed in to change notification settings - Fork 0
Generator
github-actions edited this page Apr 10, 2026
·
2 revisions
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
- Loads the license template content
- Resolves placeholders with metadata (year, author, project, organization)
- 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\Reader $reader, \FastForward\DevTools\License\Resolver $resolver, \FastForward\DevTools\License\TemplateLoader $templateLoader, \FastForward\DevTools\License\PlaceholderResolver $placeholderResolver, \Symfony\Component\Filesystem\Filesystem $filesystem = new \Symfony\Component\Filesystem\Filesystem()): mixedParameters:
| Parameter | Type | Description |
|---|---|---|
$reader |
\FastForward\DevTools\License\Reader | The reader for extracting metadata from composer.json |
$resolver |
\FastForward\DevTools\License\Resolver | The resolver for mapping license identifiers to templates |
$templateLoader |
\FastForward\DevTools\License\TemplateLoader | The loader for reading template files |
$placeholderResolver |
\FastForward\DevTools\License\PlaceholderResolver | The resolver for template placeholders |
$filesystem |
\Symfony\Component\Filesystem\Filesystem | 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
Checks whether a supported license is present in composer.json.
public hasLicense(): boolReturn Value:
True if a supported license is defined, false otherwise