mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-20 08:30:06 +00:00
Code cleanup
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user