You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
virt/web/app/Services/Cloud/CloudTemplateImportId.php

16 lines
375 B
PHP

<?php
namespace App\Services\Cloud;
/** The non-secret identity accepted by both import reads and mutations. */
final class CloudTemplateImportId
{
public static function parse(string $id): string
{
if (preg_match('/^[a-f0-9]{32}$/D', $id) !== 1) {
throw new CloudError('云镜像导入标识无效', 422);
}
return $id;
}
}