Add ratio to template creators

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2021-01-18 16:11:09 +01:00
parent 78e114ed72
commit 66fa3fca83
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
1 changed files with 29 additions and 1 deletions

View File

@ -34,7 +34,11 @@ final class TemplateFileCreator implements \JsonSerializable {
protected $actionName;
protected $fileExtension;
protected $iconClass;
protected $ratio = null;
/**
* @since 21.0.0
*/
public function __construct(
string $appId, string $actionName, string $fileExtension
) {
@ -43,31 +47,55 @@ final class TemplateFileCreator implements \JsonSerializable {
$this->fileExtension = $fileExtension;
}
/**
* @since 21.0.0
*/
public function getAppId(): string {
return $this->appId;
}
/**
* @since 21.0.0
*/
public function setIconClass(string $iconClass): TemplateFileCreator {
$this->iconClass = $iconClass;
return $this;
}
/**
* @since 21.0.0
*/
public function addMimetype(string $mimetype): TemplateFileCreator {
$this->mimetypes[] = $mimetype;
return $this;
}
/**
* @since 21.0.0
*/
public function getMimetypes(): array {
return $this->mimetypes;
}
/**
* @since 21.0.0
*/
public function setRatio(float $ratio) {
$this->ratio = $ratio;
return $this;
}
/**
* @since 21.0.0
*/
public function jsonSerialize() {
return [
'app' => $this->appId,
'label' => $this->actionName,
'extension' => $this->fileExtension,
'iconClass' => $this->iconClass,
'mimetypes' => $this->mimetypes
'mimetypes' => $this->mimetypes,
'ratio' => $this->ratio
];
}
}