From 0f0f637ea487e93d3c4355c4ea7667da3da9444f Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Thu, 2 Jun 2022 17:13:04 -0500 Subject: [PATCH] Minor: Format code --- src/CoreBundle/Entity/Asset.php | 92 ++++++++++++++++----------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/src/CoreBundle/Entity/Asset.php b/src/CoreBundle/Entity/Asset.php index 38293a8d9b..7b0be59ce1 100644 --- a/src/CoreBundle/Entity/Asset.php +++ b/src/CoreBundle/Entity/Asset.php @@ -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; }