feat(core): add system store service interface
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user