Files
server/shared/lib/SystemStore/BlobInfo.php
T
2026-08-28 20:25:58 -04:00

41 lines
965 B
PHP

<?php
declare(strict_types=1);
namespace KTXF\SystemStore;
use DateTimeImmutable;
use InvalidArgumentException;
/**
* Provider-neutral information about a blob in a system store.
*/
final readonly class BlobInfo
{
public function __construct(
public string $key,
public string $mimeType,
public int $size,
public string $etag,
public DateTimeImmutable $modifiedAt,
public array $attributes = [],
) {
if ($this->key === '') {
throw new InvalidArgumentException('Blob key cannot be empty');
}
if ($this->mimeType === '') {
throw new InvalidArgumentException('Blob MIME type cannot be empty');
}
if ($this->size < 0) {
throw new InvalidArgumentException('Blob size cannot be negative');
}
if ($this->etag === '') {
throw new InvalidArgumentException('Blob ETag cannot be empty');
}
}
}