From f64bf8437c05b6f9c01f7d454a1cfe52317a935a Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Tue, 20 Aug 2024 17:37:59 +0200 Subject: [PATCH] Reorder methods --- .../src/Support/Filesystem/MediaFile.php | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/packages/framework/src/Support/Filesystem/MediaFile.php b/packages/framework/src/Support/Filesystem/MediaFile.php index 4d0c52a7ebd..704a9cbf0d1 100644 --- a/packages/framework/src/Support/Filesystem/MediaFile.php +++ b/packages/framework/src/Support/Filesystem/MediaFile.php @@ -95,17 +95,19 @@ public function getIdentifier(): string } /** - * Get the file information as an array. - * - * @return array{name: string, path: string, length: int, mimeType: string, hash: string} + * Get a relative web link to the media file. */ - public function toArray(): array + public function getLink(): string { - return array_merge(parent::toArray(), [ - 'length' => $this->getContentLength(), - 'mimeType' => $this->getMimeType(), - 'hash' => $this->getHash(), - ]); + $name = $this->getIdentifier(); + + $name = Str::start($name, Hyde::getMediaOutputDirectory().'/'); + + if (Hyde::hasSiteUrl()) { + return Hyperlinks::withCacheBusting(Hyde::url($name), $name); + } + + return Hyperlinks::withCacheBusting(Hyde::relativeLink($name), $name); } /** @@ -139,19 +141,17 @@ public function getHash(): string } /** - * Get a relative web link to the media file. + * Get the file information as an array. + * + * @return array{name: string, path: string, length: int, mimeType: string, hash: string} */ - public function getLink(): string + public function toArray(): array { - $name = $this->getIdentifier(); - - $name = Str::start($name, Hyde::getMediaOutputDirectory().'/'); - - if (Hyde::hasSiteUrl()) { - return Hyperlinks::withCacheBusting(Hyde::url($name), $name); - } - - return Hyperlinks::withCacheBusting(Hyde::relativeLink($name), $name); + return array_merge(parent::toArray(), [ + 'length' => $this->getContentLength(), + 'mimeType' => $this->getMimeType(), + 'hash' => $this->getHash(), + ]); } /** @internal */