imageEditOptions
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Mathieu 2024-03-18 08:36:14 +00:00
parent 557c6e5ee3
commit 8772e50122
2 changed files with 67 additions and 1 deletions

View File

@ -20,6 +20,10 @@ class FileRequest
* @var Metadata
*/
private $metadata;
/**
* @var ImageEditOptions
*/
private $imageEditOptions;
public function __construct(string $url, string $fallbackUrl = null)
{
@ -28,6 +32,7 @@ class FileRequest
$this->fileOptions = new FileOptions();
$this->metadata = new Metadata();
$this->imageEditOptions = new ImageEditOptions();
}
public function url(string $url)
@ -68,6 +73,18 @@ class FileRequest
return $this->metadata;
}
public function imageEditOptions(ImageEditOptions $imageEditOptions)
{
$this->imageEditOptions = $imageEditOptions;
return $this;
}
public function getImageEditOptions(): ImageEditOptions
{
return $this->imageEditOptions;
}
public function getUrl(): string
{
return $this->url;
@ -84,7 +101,8 @@ class FileRequest
'url' => $this->url,
'fallbackUrl' => $this->fallbackUrl,
'fileOptions' => $this->fileOptions->toArray(),
'metadata' => $this->metadata->toArray()
'metadata' => $this->metadata->toArray(),
'imageEditOptions' => $this->imageEditOptions->toArray()
]);
}
}

48
src/ImageEditOptions.php Normal file
View File

@ -0,0 +1,48 @@
<?php
namespace Nwb\MultiDownloaderClient;
class ImageEditOptions
{
/**
* @var int
*/
private $width;
/**
* @var int
*/
private $height;
public function width(int $width)
{
$this->width = $width;
return $this;
}
public function getWidth(): int
{
return $this->width;
}
public function height(int $height)
{
$this->height = $height;
return $this;
}
public function getHeight(): int
{
return $this->height;
}
public function toArray(): array
{
return array_filter([
'width' => $this->width,
'height' => $this->height
]);
}
}