This commit is contained in:
Mathieu 2024-03-14 15:47:40 +00:00
parent 0862eee2b5
commit 454f9b9c58
2 changed files with 66 additions and 0 deletions

View File

@ -16,6 +16,10 @@ class FileRequest
* @var FileOptions
*/
private $fileOptions;
/**
* @var Metadata
*/
private $metadata;
public function __construct(string $url, string $fallbackUrl = null)
{
@ -23,6 +27,7 @@ class FileRequest
$this->fallbackUrl = $fallbackUrl;
$this->fileOptions = new FileOptions();
$this->metadata = new Metadata();
}
public function url(string $url)
@ -51,6 +56,18 @@ class FileRequest
return $this->fileOptions;
}
public function metadata(Metadata $metadata)
{
$this->metadata = $metadata;
return $this;
}
public function getMetadata(): Metadata
{
return $this->metadata;
}
public function getUrl(): string
{
return $this->url;
@ -67,6 +84,7 @@ class FileRequest
'url' => $this->url,
'fallbackUrl' => $this->fallbackUrl,
'fileOptions' => $this->fileOptions->toArray(),
'metadata' => $this->metadata->toArray()
]);
}
}

48
src/Metadata.php Normal file
View File

@ -0,0 +1,48 @@
<?php
namespace Nwb\MultiDownloaderClient;
class Metadata
{
/**
* @var bool
*/
private $deleteAll;
/**
* @var array
*/
private $set;
public function deleteAll(string $deleteAll)
{
$this->deleteAll = $deleteAll;
return $this;
}
public function getDeleteAll(): string
{
return $this->deleteAll;
}
public function set(array $set)
{
$this->set = $set;
return $this;
}
public function getSet(): array
{
return $this->set;
}
public function toArray(): array
{
return array_filter([
'deleteAll' => $this->deleteAll,
'set' => $this->set
]);
}
}