Documentation

SpdxLicenses
in package

Table of Contents

EXCEPTIONS_FILE  = 'spdx-exceptions.json'
LICENSES_FILE  = 'spdx-licenses.json'
$exceptions  : array<string|int, mixed>
Contains all the license exceptions.
$exceptionsExpression  : string
$licenses  : array<string|int, mixed>
Contains all the licenses.
$licensesExpression  : string
__construct()  : mixed
getExceptionByIdentifier()  : array<string|int, mixed>|null
Returns license exception metadata by license exception identifier.
getIdentifierByName()  : string|null
Returns the short identifier of a license (or license exception) by full name.
getLicenseByIdentifier()  : array<string|int, mixed>|null
Returns license metadata by license identifier.
getLicenses()  : array<string|int, array<string|int, mixed>>
Returns all licenses information, keyed by the lowercased license identifier.
getResourcesDir()  : string
isDeprecatedByIdentifier()  : bool
Returns the deprecation status for a license by identifier.
isOsiApprovedByIdentifier()  : bool
Returns the OSI Approved status for a license by identifier.
validate()  : bool
getExceptionsExpression()  : string
getLicensesExpression()  : string
isValidLicenseString()  : bool
loadExceptions()  : mixed
loadLicenses()  : mixed

Constants

EXCEPTIONS_FILE

public string EXCEPTIONS_FILE = 'spdx-exceptions.json'

LICENSES_FILE

public string LICENSES_FILE = 'spdx-licenses.json'

Properties

$exceptions

Contains all the license exceptions.

private array<string|int, mixed> $exceptions

The array is indexed by license exception identifiers, which contain a numerically indexed array with license exception details.

[ lowercased exception identifier => [ 0 => exception identifier (string), 1 => full name (string) ] , ... ]

$exceptionsExpression

private string $exceptionsExpression

$licenses

Contains all the licenses.

private array<string|int, mixed> $licenses

The array is indexed by license identifiers, which contain a numerically indexed array with license details.

[ lowercased license identifier => [ 0 => identifier (string), 1 => full name (string), 2 => osi certified (bool), 3 => deprecated (bool) ] , ... ]

Methods

__construct()

public __construct() : mixed
Return values
mixed —

getExceptionByIdentifier()

Returns license exception metadata by license exception identifier.

public getExceptionByIdentifier(string $identifier) : array<string|int, mixed>|null

This function adds a link to the full license exception text to the license exception metadata. The array returned is in the form of:

[ 0 => full name (string), 1 => link to license text (string) ]

Parameters
$identifier : string
Return values
array<string|int, mixed>|null —

getIdentifierByName()

Returns the short identifier of a license (or license exception) by full name.

public getIdentifierByName(string $name) : string|null
Parameters
$name : string
Return values
string|null —

getLicenseByIdentifier()

Returns license metadata by license identifier.

public getLicenseByIdentifier(string $identifier) : array<string|int, mixed>|null

This function adds a link to the full license text to the license metadata. The array returned is in the form of:

[ 0 => full name (string), 1 => osi certified, 2 => link to license text (string), 3 => deprecation status (bool) ]

Parameters
$identifier : string
Return values
array<string|int, mixed>|null —

getLicenses()

Returns all licenses information, keyed by the lowercased license identifier.

public getLicenses() : array<string|int, array<string|int, mixed>>
Return values
array<string|int, array<string|int, mixed>> —

Each item is [ 0 => identifier (string), 1 => full name (string), 2 => osi certified (bool), 3 => deprecated (bool) ]

getResourcesDir()

public static getResourcesDir() : string
Return values
string —

isDeprecatedByIdentifier()

Returns the deprecation status for a license by identifier.

public isDeprecatedByIdentifier(string $identifier) : bool
Parameters
$identifier : string
Return values
bool —

isOsiApprovedByIdentifier()

Returns the OSI Approved status for a license by identifier.

public isOsiApprovedByIdentifier(string $identifier) : bool
Parameters
$identifier : string
Return values
bool —

validate()

public validate(array<string|int, mixed>|string $license) : bool
Parameters
$license : array<string|int, mixed>|string
Tags
throws
InvalidArgumentException
Return values
bool —

getExceptionsExpression()

private getExceptionsExpression() : string
Return values
string —

getLicensesExpression()

private getLicensesExpression() : string
Return values
string —

isValidLicenseString()

private isValidLicenseString(string $license) : bool
Parameters
$license : string
Tags
throws
RuntimeException
Return values
bool —

loadExceptions()

private loadExceptions() : mixed
Return values
mixed —

loadLicenses()

private loadLicenses() : mixed
Return values
mixed —

Search results