9 namespace Fossology\Lib\Data;
32 const SPDXREF_PREFIX =
"LicenseRef-";
37 const SPDXREF_PREFIX_FOSSOLOGY =
"LicenseRef-fossology-";
45 function __construct($licenseId, $licenseShortName, $licenseName, $spdxId)
47 $this->
id = $licenseId;
48 $this->shortName = $licenseShortName;
49 $this->fullName = $licenseName ? : $licenseShortName;
66 return $this->fullName;
74 return $this->shortName;
85 public function __toString()
90 .
", ".$this->shortName
108 if (strcasecmp($shortname, LicenseDao::NO_LICENSE_FOUND) === 0 ||
109 strcasecmp($shortname, LicenseDao::VOID_LICENSE) === 0) {
110 $spdxLicense = $shortname;
111 } elseif (empty($spdxId)) {
112 $spdxLicense = $shortname;
114 $spdxLicense = self::SPDXREF_PREFIX_FOSSOLOGY . $shortname;
117 $spdxLicense = $spdxId;
121 $spdxLicense = preg_replace(
'/\+$/',
'-or-later', $spdxLicense);
134 $licenseName = str_replace(
' ',
'-', $licenseName);
135 return preg_replace(
'/-(OR|AND|WITH)-(?!later)/i',
' $1 ', $licenseName);
static convertToSpdxId($shortname, $spdxId)
Given a license's shortname and spdx id, give out spdx id to use in reports.
static replaceSpaces($licenseName)
__construct($licenseId, $licenseShortName, $licenseName, $spdxId)
static stringStartsWith($haystack, $needle)