forked from LiveCarta/yii2-aws-s3
added params in UploadCommand; close #16
This commit is contained in:
@@ -176,6 +176,62 @@ class UploadCommand extends ExecutableCommand implements HasBucket, HasAcl, Asyn
|
|||||||
return $this;
|
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
|
* @return array
|
||||||
*/
|
*/
|
||||||
@@ -195,4 +251,24 @@ class UploadCommand extends ExecutableCommand implements HasBucket, HasAcl, Asyn
|
|||||||
|
|
||||||
return $this;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user