feat: implement preview manager
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -11,12 +11,11 @@ final class TenantPreview extends JsonSerializableObject
|
||||
{
|
||||
protected bool $enabled = true;
|
||||
protected string $store = 'previews';
|
||||
protected TenantPreviewGeneration $generation;
|
||||
protected int $maxSourceSize = 26214400;
|
||||
protected TenantPreviewVariants $variants;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->generation = new TenantPreviewGeneration();
|
||||
$this->variants = new TenantPreviewVariants();
|
||||
}
|
||||
|
||||
@@ -40,11 +39,11 @@ final class TenantPreview extends JsonSerializableObject
|
||||
$this->store = $data['store'];
|
||||
}
|
||||
|
||||
if (array_key_exists('generation', $data)) {
|
||||
if (!is_array($data['generation'])) {
|
||||
throw new InvalidArgumentException('Preview generation configuration must be an object');
|
||||
if (array_key_exists('maxSourceSize', $data)) {
|
||||
if (!is_int($data['maxSourceSize']) || $data['maxSourceSize'] < 1) {
|
||||
throw new InvalidArgumentException('Preview maximum source size must be a positive integer');
|
||||
}
|
||||
$this->generation->jsonDeserialize($data['generation']);
|
||||
$this->maxSourceSize = $data['maxSourceSize'];
|
||||
}
|
||||
|
||||
if (array_key_exists('variants', $data)) {
|
||||
@@ -71,9 +70,9 @@ final class TenantPreview extends JsonSerializableObject
|
||||
return $this->store;
|
||||
}
|
||||
|
||||
public function generation(): TenantPreviewGeneration
|
||||
public function maxSourceSize(): int
|
||||
{
|
||||
return $this->generation;
|
||||
return $this->maxSourceSize;
|
||||
}
|
||||
|
||||
public function variants(): TenantPreviewVariants
|
||||
|
||||
Reference in New Issue
Block a user