From 454f9b9c583c583b70c24d435bdafbfef34846b7 Mon Sep 17 00:00:00 2001 From: Mathieu Date: Thu, 14 Mar 2024 15:47:40 +0000 Subject: [PATCH] metadata --- src/FileRequest.php | 18 +++++++++++++++++ src/Metadata.php | 48 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 src/Metadata.php diff --git a/src/FileRequest.php b/src/FileRequest.php index d25e494..deeed62 100644 --- a/src/FileRequest.php +++ b/src/FileRequest.php @@ -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() ]); } } diff --git a/src/Metadata.php b/src/Metadata.php new file mode 100644 index 0000000..7596617 --- /dev/null +++ b/src/Metadata.php @@ -0,0 +1,48 @@ +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 + ]); + } +}