30a8eddf06
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
26 lines
694 B
PHP
26 lines
694 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace KTXF\Preview;
|
|
|
|
use InvalidArgumentException;
|
|
use KTXF\Resource\BinaryResource;
|
|
|
|
final readonly class PreviewResult
|
|
{
|
|
public function __construct(
|
|
public BinaryResource $resource,
|
|
public ?int $width = null,
|
|
public ?int $height = null,
|
|
) {
|
|
MimeType::normalize($this->resource->mimeType());
|
|
if ($this->width !== null && $this->width < 1) {
|
|
throw new InvalidArgumentException('Preview result width must be positive');
|
|
}
|
|
if ($this->height !== null && $this->height < 1) {
|
|
throw new InvalidArgumentException('Preview result height must be positive');
|
|
}
|
|
}
|
|
}
|