function SpdxLicenses::validate
Parameters
string[]|string $license:
Return value
bool
Throws
\InvalidArgumentException
File
-
vendor/
composer/ spdx-licenses/ src/ SpdxLicenses.php, line 191
Class
Namespace
Composer\SpdxCode
public function validate($license) {
if (is_array($license)) {
$count = count($license);
if ($count !== count(array_filter($license, 'is_string'))) {
throw new \InvalidArgumentException('Array of strings expected.');
}
$license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license);
}
if (!is_string($license)) {
throw new \InvalidArgumentException(sprintf('Array or String expected, %s given.', gettype($license)));
}
return $this->isValidLicenseString($license);
}