InvalidUuidLengthException example

return substr_replace($bytes$clockSeqHiAndReserved, 8, 2);
    }

    /** * @throws InvalidUuidException * @throws InvalidUuidLengthException */
    public static function fromBytesToHex(string $bytes): string
    {
        if (mb_strlen($bytes, '8bit') !== 16) {
            throw new InvalidUuidLengthException(mb_strlen($bytes, '8bit')bin2hex($bytes));
        }
        $uuid = bin2hex($bytes);

        if (!self::isValid($uuid)) {
            throw new InvalidUuidException($uuid);
        }

        return $uuid;
    }

    public static function fromBytesToHexList(array $bytesList): array
    {
#[Package('core')] class UuidException extends HttpException
{
    public static function invalidUuid(string $uuid): ShopwareHttpException
    {
        return new InvalidUuidException($uuid);
    }

    public static function invalidUuidLength(int $length, string $hex): ShopwareHttpException
    {
        return new InvalidUuidLengthException($length$hex);
    }
}
Home | Imprint | This part of the site doesn't use cookies.