7 namespace Fossology\ReportImport;
13 private static function getTokensFromlicenseExpression($licenseExpr)
15 return array_filter(explode(
' ', str_replace(array(
"(",
")"),
" ", $licenseExpr)));
18 public static function getShortnamesFromLicenseExpression($licenseExpr)
20 $licenseExprTokens = self::getTokensFromlicenseExpression($licenseExpr);
21 $shortnames = array();
22 $licenseRefPrefix =
"LicenseRef-";
23 foreach($licenseExprTokens as $token){
26 $shortnames[] =
"Dual-license";
28 else if(substr($token, 0, strlen($licenseRefPrefix)) === $licenseRefPrefix)
30 $shortnames[] = urldecode(substr($token, strlen($licenseRefPrefix)));
34 $shortnames[] = urldecode($token);
40 public static function stripPrefix($str)
42 $parts = explode(
'#', $str, 2);
43 if (
sizeof($parts) === 2)
50 public static function stripPrefixes($strs)
52 return array_map(array(__CLASS__,
"stripPrefix"), $strs);