Files
michaelschiemer/src/Framework/Id/Ulid/UlidValidator.php

21 lines
391 B
PHP

<?php
declare(strict_types=1);
namespace App\Framework\Id\Ulid;
/**
* Validiert ULID-Strings.
*/
final readonly class UlidValidator
{
/**
* @param string $ulid
* @return bool true, wenn $ulid exakt 26 Zeichen Crockford-Base32 sind
*/
public function isValid(string $ulid): bool
{
return (bool) preg_match('/^[0-9A-HJKMNP-TV-Z]{26}$/', $ulid);
}
}