Resolves license identifiers to their corresponding template filenames.
Description
This class maintains a mapping of supported open-source licenses to their template files and provides methods to check support and resolve licenses.
Interfaces
Constants
= ['MIT' => 'mit.txt', 'BSD-2-Clause' => 'bsd-2-clause.txt', 'BSD-3-Clause' => 'bsd-3-clause.txt', 'Apache-2.0' => 'apache-2.0.txt', 'Apache-2' => 'apache-2.0.txt', 'GPL-3.0-or-later' => 'gpl-3.0-or-later.txt', 'GPL-3.0' => 'gpl-3.0-or-later.txt', 'GPL-3+' => 'gpl-3.0-or-later.txt', 'LGPL-3.0-or-later' => 'lgpl-3.0-or-later.txt', 'LGPL-3.0' => 'lgpl-3.0-or-later.txt', 'LGPL-3+' => 'lgpl-3.0-or-later.txt', 'MPL-2.0' => 'mpl-2.0.txt', 'ISC' => 'isc.txt', 'Unlicense' => 'unlicense.txt']
Methods
resolve()
: string|null
Resolves a license identifier to its template filename.
normalize()
: string
Normalizes the license identifier for comparison.
Constants
private
mixed
SUPPORTED_LICENSES
=
['MIT' => 'mit.txt', 'BSD-2-Clause' => 'bsd-2-clause.txt', 'BSD-3-Clause' => 'bsd-3-clause.txt', 'Apache-2.0' => 'apache-2.0.txt', 'Apache-2' => 'apache-2.0.txt', 'GPL-3.0-or-later' => 'gpl-3.0-or-later.txt', 'GPL-3.0' => 'gpl-3.0-or-later.txt', 'GPL-3+' => 'gpl-3.0-or-later.txt', 'LGPL-3.0-or-later' => 'lgpl-3.0-or-later.txt', 'LGPL-3.0' => 'lgpl-3.0-or-later.txt', 'LGPL-3+' => 'lgpl-3.0-or-later.txt', 'MPL-2.0' => 'mpl-2.0.txt', 'ISC' => 'isc.txt', 'Unlicense' => 'unlicense.txt']
Resolves a license identifier to its template filename.
public
resolve(
string
$license) : string|null
Parameters
$license
:
string
Description
The license identifier to resolve
Return values
string|null
Description
The template filename if supported, or null if not
Normalizes the license identifier for comparison.
private
normalize(
string
$license) : string
Parameters
$license
:
string
Description
The license identifier to normalize
Return values
string
Description
The normalized license string