chore: code cleanup.

This commit is contained in:
James Cole
2023-05-29 13:56:55 +02:00
parent 7f7644c92f
commit 1b52147a05
295 changed files with 12418 additions and 12324 deletions

View File

@@ -34,9 +34,9 @@ use FireflyIII\User;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use League\Flysystem\UnableToDeleteFile;
use Illuminate\Support\Facades\Log;
use LogicException;
/**
@@ -70,6 +70,27 @@ class AttachmentRepository implements AttachmentRepositoryInterface
return true;
}
/**
* @param Attachment $attachment
*
* @return bool
*/
public function exists(Attachment $attachment): bool
{
/** @var Storage $disk */
$disk = Storage::disk('upload');
return $disk->exists($attachment->fileName());
}
/**
* @return Collection
*/
public function get(): Collection
{
return $this->user->attachments()->get();
}
/**
* @param Attachment $attachment
*
@@ -95,27 +116,6 @@ class AttachmentRepository implements AttachmentRepositoryInterface
return $unencryptedContent;
}
/**
* @param Attachment $attachment
*
* @return bool
*/
public function exists(Attachment $attachment): bool
{
/** @var Storage $disk */
$disk = Storage::disk('upload');
return $disk->exists($attachment->fileName());
}
/**
* @return Collection
*/
public function get(): Collection
{
return $this->user->attachments()->get();
}
/**
* Get attachment note text or empty string.
*
@@ -133,6 +133,16 @@ class AttachmentRepository implements AttachmentRepositoryInterface
return null;
}
/**
* @param User|Authenticatable|null $user
*/
public function setUser(User|Authenticatable|null $user): void
{
if (null !== $user) {
$this->user = $user;
}
}
/**
* @param array $data
*
@@ -152,16 +162,6 @@ class AttachmentRepository implements AttachmentRepositoryInterface
return $result;
}
/**
* @param User|Authenticatable|null $user
*/
public function setUser(User|Authenticatable|null $user): void
{
if (null !== $user) {
$this->user = $user;
}
}
/**
* @param Attachment $attachment
* @param array $data