From 55fa650f529fc07ac242ed109cf12c756eb8174b Mon Sep 17 00:00:00 2001 From: frostealth Date: Fri, 7 Oct 2016 13:27:23 +0600 Subject: [PATCH] added params in UploadCommand; close #16 --- src/commands/UploadCommand.php | 76 ++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/src/commands/UploadCommand.php b/src/commands/UploadCommand.php index 6909e0d..6442101 100644 --- a/src/commands/UploadCommand.php +++ b/src/commands/UploadCommand.php @@ -176,6 +176,62 @@ class UploadCommand extends ExecutableCommand implements HasBucket, HasAcl, Asyn return $this; } + /** + * @return string + */ + public function getContentType(): string + { + return $this->getParam('ContentType', ''); + } + + /** + * @param string $contentType + * + * @return $this + */ + public function setContentType(string $contentType) + { + $this->setParam('ContentType', $contentType); + + return $this; + } + + /** + * @return string + */ + public function getContentDisposition(): string + { + return $this->getParam('ContentDisposition', ''); + } + + /** + * @param string $contentDisposition + * + * @return $this + */ + public function setContentDisposition(string $contentDisposition) + { + $this->setParam('ContentDisposition', $contentDisposition); + + return $this; + } + + /** + * @return array + */ + public function getParams(): array + { + return $this->options['params'] ?? []; + } + + /** + * @param array $params + */ + public function setParams(array $params) + { + $this->options['params'] = $params; + } + /** * @return array */ @@ -195,4 +251,24 @@ class UploadCommand extends ExecutableCommand implements HasBucket, HasAcl, Asyn return $this; } + + /** + * @param string $name + * @param mixed $default + * + * @return mixed + */ + protected function getParam(string $name, $default) + { + return $this->options['params'][$name] ?? $default; + } + + /** + * @param string $name + * @param mixed $value + */ + protected function setParam(string $name, $value) + { + $this->options['params'][$name] = $value; + } }