24 private static function getTokensFromlicenseExpression($licenseExpr)
26 return array_filter(explode(
' ', str_replace(array(
"(",
")"),
" ", $licenseExpr)));
29 public static function getShortnamesFromLicenseExpression($licenseExpr)
31 $licenseExprTokens = self::getTokensFromlicenseExpression($licenseExpr);
32 $shortnames = array();
33 $licenseRefPrefix =
"LicenseRef-";
34 foreach($licenseExprTokens as $token){
37 $shortnames[] =
"Dual-license";
39 else if(substr($token, 0, strlen($licenseRefPrefix)) === $licenseRefPrefix)
41 $shortnames[] = urldecode(substr($token, strlen($licenseRefPrefix)));
45 $shortnames[] = urldecode($token);
51 public static function stripPrefix($str)
53 $parts = explode(
'#', $str, 2);
54 if (
sizeof($parts) === 2)
61 public static function stripPrefixes($strs)
63 return array_map(array(__CLASS__,
"stripPrefix"), $strs);