|
|
|
@ -149,14 +149,21 @@ class Asset |
|
|
|
|
return $this->getOriginalName(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getId(): Uuid |
|
|
|
|
public function getOriginalName(): string |
|
|
|
|
{ |
|
|
|
|
return $this->id; |
|
|
|
|
return (string) $this->originalName; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getFolder(): string |
|
|
|
|
public function setOriginalName(?string $originalName): self |
|
|
|
|
{ |
|
|
|
|
return $this->category.'/'.$this->getOriginalName(); |
|
|
|
|
$this->originalName = $originalName; |
|
|
|
|
|
|
|
|
|
return $this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getId(): Uuid |
|
|
|
|
{ |
|
|
|
|
return $this->id; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getFileUrl(): string |
|
|
|
@ -164,6 +171,11 @@ class Asset |
|
|
|
|
return $this->getFolder().'/'.$this->getOriginalName(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getFolder(): string |
|
|
|
|
{ |
|
|
|
|
return $this->category.'/'.$this->getOriginalName(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function isImage(): bool |
|
|
|
|
{ |
|
|
|
|
$mimeType = $this->getMimeType(); |
|
|
|
@ -171,6 +183,18 @@ class Asset |
|
|
|
|
return str_contains($mimeType, 'image'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getMimeType(): ?string |
|
|
|
|
{ |
|
|
|
|
return $this->mimeType; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function setMimeType(?string $mimeType): self |
|
|
|
|
{ |
|
|
|
|
$this->mimeType = $mimeType; |
|
|
|
|
|
|
|
|
|
return $this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function isVideo(): bool |
|
|
|
|
{ |
|
|
|
|
$mimeType = $this->getMimeType(); |
|
|
|
@ -202,31 +226,19 @@ class Asset |
|
|
|
|
return $this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getMimeType(): ?string |
|
|
|
|
{ |
|
|
|
|
return $this->mimeType; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function setMimeType(?string $mimeType): self |
|
|
|
|
{ |
|
|
|
|
$this->mimeType = $mimeType; |
|
|
|
|
|
|
|
|
|
return $this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getOriginalName(): string |
|
|
|
|
public function getWidth(): int |
|
|
|
|
{ |
|
|
|
|
return (string) $this->originalName; |
|
|
|
|
} |
|
|
|
|
$data = $this->getDimensions(); |
|
|
|
|
if ([] !== $data) { |
|
|
|
|
//$data = explode(',', $data); |
|
|
|
|
|
|
|
|
|
public function setOriginalName(?string $originalName): self |
|
|
|
|
{ |
|
|
|
|
$this->originalName = $originalName; |
|
|
|
|
return (int) $data[0]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $this; |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getDimensions(): array |
|
|
|
|
public function getDimensions(): ?array |
|
|
|
|
{ |
|
|
|
|
return $this->dimensions; |
|
|
|
|
} |
|
|
|
@ -238,18 +250,6 @@ class Asset |
|
|
|
|
return $this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getWidth(): int |
|
|
|
|
{ |
|
|
|
|
$data = $this->getDimensions(); |
|
|
|
|
if ([] !== $data) { |
|
|
|
|
//$data = explode(',', $data); |
|
|
|
|
|
|
|
|
|
return (int) $data[0]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getHeight(): int |
|
|
|
|
{ |
|
|
|
|
$data = $this->getDimensions(); |
|
|
|
@ -263,7 +263,7 @@ class Asset |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getMetadata(): array |
|
|
|
|
public function getMetadata(): ?array |
|
|
|
|
{ |
|
|
|
|
return $this->metadata; |
|
|
|
|
} |
|
|
|
@ -275,7 +275,7 @@ class Asset |
|
|
|
|
return $this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getDescription(): string |
|
|
|
|
public function getDescription(): ?string |
|
|
|
|
{ |
|
|
|
|
return $this->description; |
|
|
|
|
} |
|
|
|
@ -287,16 +287,11 @@ class Asset |
|
|
|
|
return $this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getFile(): ?File |
|
|
|
|
public function getFile(): File |
|
|
|
|
{ |
|
|
|
|
return $this->file; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function hasFile(): bool |
|
|
|
|
{ |
|
|
|
|
return null !== $this->file; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param File|UploadedFile $file |
|
|
|
|
*/ |
|
|
|
@ -313,7 +308,12 @@ class Asset |
|
|
|
|
return $this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getTitle(): string |
|
|
|
|
public function hasFile(): bool |
|
|
|
|
{ |
|
|
|
|
return !empty($this->file); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getTitle(): ?string |
|
|
|
|
{ |
|
|
|
|
return $this->title; |
|
|
|
|
} |
|
|
|
@ -325,7 +325,7 @@ class Asset |
|
|
|
|
return $this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getCategory(): string |
|
|
|
|
public function getCategory(): ?string |
|
|
|
|
{ |
|
|
|
|
return $this->category; |
|
|
|
|
} |
|
|
|
|