feat: implement preview manager

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-08-29 18:42:30 -04:00
parent eaea5f4c83
commit f39ad1804d
13 changed files with 676 additions and 175 deletions
+7 -8
View File
@@ -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