Code cleanup

This commit is contained in:
James Cole
2024-12-22 08:43:12 +01:00
parent 5751f7e5a3
commit 565bd87959
574 changed files with 4600 additions and 4604 deletions

View File

@@ -71,7 +71,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface
$unencryptedContent = '';
if ($disk->exists($file)) {
$encryptedContent = (string)$disk->get($file);
$encryptedContent = (string) $disk->get($file);
try {
$unencryptedContent = \Crypt::decrypt($encryptedContent); // verified
@@ -104,7 +104,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface
{
$note = $attachment->notes()->first();
if (null !== $note) {
return (string)$note->text;
return (string) $note->text;
}
return null;
@@ -139,20 +139,20 @@ class AttachmentRepository implements AttachmentRepositoryInterface
$attachment->title = $data['title'];
}
if (array_key_exists('filename', $data) && '' !== (string)$data['filename'] && $data['filename'] !== $attachment->filename) {
if (array_key_exists('filename', $data) && '' !== (string) $data['filename'] && $data['filename'] !== $attachment->filename) {
$attachment->filename = $data['filename'];
}
// update model (move attachment)
// should be validated already:
if (array_key_exists('attachable_type', $data) && array_key_exists('attachable_id', $data)) {
$attachment->attachable_id = (int)$data['attachable_id'];
$attachment->attachable_id = (int) $data['attachable_id'];
$attachment->attachable_type = sprintf('FireflyIII\Models\%s', $data['attachable_type']);
}
$attachment->save();
$attachment->refresh();
if (array_key_exists('notes', $data)) {
$this->updateNote($attachment, (string)$data['notes']);
$this->updateNote($attachment, (string) $data['notes']);
}
return $attachment;