FOSSology  4.4.0
Open Source License Compliance by Open Source Software
Fossology\Lib\Data\LicenseRef Class Reference
Inheritance diagram for Fossology\Lib\Data\LicenseRef:
Inheritance graph
Collaboration diagram for Fossology\Lib\Data\LicenseRef:
Collaboration graph

Public Member Functions

 __construct ($licenseId, $licenseShortName, $licenseName, $spdxId)
 
 getId ()
 
 getFullName ()
 
 getShortName ()
 
 getSpdxId ()
 
 __toString ()
 

Static Public Member Functions

static convertToSpdxId ($shortname, $spdxId)
 Given a license's shortname and spdx id, give out spdx id to use in reports. More...
 
static replaceSpaces ($licenseName)
 

Public Attributes

const SPDXREF_PREFIX = "LicenseRef-"
 
const SPDXREF_PREFIX_FOSSOLOGY = "LicenseRef-fossology-"
 

Private Attributes

 $id
 
 $shortName
 
 $fullName
 
 $spdxId
 

Detailed Description

Definition at line 14 of file LicenseRef.php.

Constructor & Destructor Documentation

◆ __construct()

Fossology\Lib\Data\LicenseRef::__construct (   $licenseId,
  $licenseShortName,
  $licenseName,
  $spdxId 
)
Parameters
$licenseId
$licenseShortName
$licenseName
string$spdxId

Definition at line 45 of file LicenseRef.php.

Member Function Documentation

◆ convertToSpdxId()

static Fossology\Lib\Data\LicenseRef::convertToSpdxId (   $shortname,
  $spdxId 
)
static

Given a license's shortname and spdx id, give out spdx id to use in reports.

  • In case, the shortname is special, return as is.
  • In case spdx id is empty, return shortname with spdx prefix.
  • Otherwise use the provided spdx id
    Parameters
    string$shortnameLicense's shortname from DB
    string | null$spdxIdLicense's spdx id from DB
    Returns
    string

Definition at line 106 of file LicenseRef.php.

◆ getFullName()

Fossology\Lib\Data\LicenseRef::getFullName ( )
Returns
string

Definition at line 64 of file LicenseRef.php.

◆ getId()

Fossology\Lib\Data\LicenseRef::getId ( )
Returns
int

Definition at line 56 of file LicenseRef.php.

◆ getShortName()

Fossology\Lib\Data\LicenseRef::getShortName ( )
Returns
string

Definition at line 72 of file LicenseRef.php.

◆ getSpdxId()

Fossology\Lib\Data\LicenseRef::getSpdxId ( )
Returns
string

Reimplemented in Fossology\Lib\Data\License.

Definition at line 80 of file LicenseRef.php.

◆ replaceSpaces()

static Fossology\Lib\Data\LicenseRef::replaceSpaces (   $licenseName)
static

Replace all spaces with '-' if they are not surrounding 'AND', 'WITH' or 'OR'

Parameters
string$licenseNameSPDX expression
Returns
string SPDX expression with space replaced with dash

Definition at line 132 of file LicenseRef.php.


The documentation for this class was generated from the following file: