Constants

LICENSES_FILE

LICENSES_FILE = 'spdx-licenses.json' : string

EXCEPTIONS_FILE

EXCEPTIONS_FILE = 'spdx-exceptions.json' : string

Properties

$licenses

$licenses : array

Contains all the 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) ] , ... ]

Type

array

$licensesExpression

$licensesExpression : string

Type

string

$exceptions

$exceptions : array

Contains all the license 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) ] , ... ]

Type

array

$exceptionsExpression

$exceptionsExpression : string

Type

string

Methods

__construct()

__construct() 

getLicenseByIdentifier()

getLicenseByIdentifier(string  $identifier) : array|null

Returns license metadata by license identifier.

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

string $identifier

Returns

array|null

getLicenses()

getLicenses() : array<mixed,array>

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

Returns

array<mixed,array> —

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

getExceptionByIdentifier()

getExceptionByIdentifier(string  $identifier) : array|null

Returns license exception metadata by license exception identifier.

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

string $identifier

Returns

array|null

getIdentifierByName()

getIdentifierByName(string  $name) : string|null

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

Parameters

string $name

Returns

string|null

isOsiApprovedByIdentifier()

isOsiApprovedByIdentifier(string  $identifier) : boolean

Returns the OSI Approved status for a license by identifier.

Parameters

string $identifier

Returns

boolean

isDeprecatedByIdentifier()

isDeprecatedByIdentifier(string  $identifier) : boolean

Returns the deprecation status for a license by identifier.

Parameters

string $identifier

Returns

boolean

validate()

validate(array|string  $license) : boolean

Parameters

array|string $license

Throws

\InvalidArgumentException

Returns

boolean

getResourcesDir()

getResourcesDir() : string

Returns

string

loadLicenses()

loadLicenses() 

loadExceptions()

loadExceptions() 

getLicensesExpression()

getLicensesExpression() : string

Returns

string

getExceptionsExpression()

getExceptionsExpression() : string

Returns

string

isValidLicenseString()

isValidLicenseString(string  $license) : boolean

Parameters

string $license

Throws

\RuntimeException

Returns

boolean