mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 12:54:52 +08:00
cs-fix
This commit is contained in:
parent
6b23f4b34a
commit
7d0577460f
@ -66,31 +66,6 @@ class ConfigValidator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws ValidationException
|
|
||||||
*/
|
|
||||||
private static function checkSingleLicense(array $license, string $name): void
|
|
||||||
{
|
|
||||||
if (!is_assoc_array($license)) {
|
|
||||||
throw new ValidationException("source {$name} license must be an object");
|
|
||||||
}
|
|
||||||
if (!isset($license['type'])) {
|
|
||||||
throw new ValidationException("source {$name} license must have type");
|
|
||||||
}
|
|
||||||
if (!in_array($license['type'], ['file', 'text'])) {
|
|
||||||
throw new ValidationException("source {$name} license type is invalid");
|
|
||||||
}
|
|
||||||
if (!in_array($license['type'], ['file', 'text'])) {
|
|
||||||
throw new ValidationException("source {$name} license type is invalid");
|
|
||||||
}
|
|
||||||
if ($license['type'] === 'file' && !isset($license['path'])) {
|
|
||||||
throw new ValidationException("source {$name} license file must have path");
|
|
||||||
}
|
|
||||||
if ($license['type'] === 'text' && !isset($license['text'])) {
|
|
||||||
throw new ValidationException("source {$name} license text must have text");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws ValidationException
|
* @throws ValidationException
|
||||||
*/
|
*/
|
||||||
@ -440,6 +415,31 @@ class ConfigValidator
|
|||||||
return $craft;
|
return $craft;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws ValidationException
|
||||||
|
*/
|
||||||
|
private static function checkSingleLicense(array $license, string $name): void
|
||||||
|
{
|
||||||
|
if (!is_assoc_array($license)) {
|
||||||
|
throw new ValidationException("source {$name} license must be an object");
|
||||||
|
}
|
||||||
|
if (!isset($license['type'])) {
|
||||||
|
throw new ValidationException("source {$name} license must have type");
|
||||||
|
}
|
||||||
|
if (!in_array($license['type'], ['file', 'text'])) {
|
||||||
|
throw new ValidationException("source {$name} license type is invalid");
|
||||||
|
}
|
||||||
|
if (!in_array($license['type'], ['file', 'text'])) {
|
||||||
|
throw new ValidationException("source {$name} license type is invalid");
|
||||||
|
}
|
||||||
|
if ($license['type'] === 'file' && !isset($license['path'])) {
|
||||||
|
throw new ValidationException("source {$name} license file must have path");
|
||||||
|
}
|
||||||
|
if ($license['type'] === 'text' && !isset($license['text'])) {
|
||||||
|
throw new ValidationException("source {$name} license text must have text");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate source type configuration (shared between source.json and pkg.json)
|
* Validate source type configuration (shared between source.json and pkg.json)
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user