f0598412f3
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
41 lines
965 B
PHP
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');
|
|
}
|
|
}
|
|
|
|
}
|