Code cleanup.

This commit is contained in:
James Cole
2023-12-20 19:35:52 +01:00
parent c4f6366642
commit 64ec0cf62e
997 changed files with 12908 additions and 28136 deletions

View File

@@ -37,7 +37,6 @@ use Illuminate\View\View;
/**
* Class AttachmentController.
*
*/
class AttachmentController extends Controller
{
@@ -45,8 +44,6 @@ class AttachmentController extends Controller
/**
* AttachmentController constructor.
*
*/
public function __construct()
{
@@ -67,8 +64,6 @@ class AttachmentController extends Controller
/**
* Form to delete an attachment.
*
* @param Attachment $attachment
*
* @return Factory|View
*/
public function delete(Attachment $attachment)
@@ -84,10 +79,7 @@ class AttachmentController extends Controller
/**
* Destroy attachment.
*
* @param Request $request
* @param Attachment $attachment
*
* @return RedirectResponse|Redirector
* @return Redirector|RedirectResponse
*/
public function destroy(Request $request, Attachment $attachment)
{
@@ -104,8 +96,6 @@ class AttachmentController extends Controller
/**
* Download attachment to PC.
*
* @param Attachment $attachment
*
* @return LaravelResponse
*
* @throws FireflyException
@@ -121,25 +111,24 @@ class AttachmentController extends Controller
$response
->header('Content-Description', 'File Transfer')
->header('Content-Type', 'application/octet-stream')
->header('Content-Disposition', 'attachment; filename=' . $quoted)
->header('Content-Disposition', 'attachment; filename='.$quoted)
->header('Content-Transfer-Encoding', 'binary')
->header('Connection', 'Keep-Alive')
->header('Expires', '0')
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
->header('Pragma', 'public')
->header('Content-Length', (string)strlen($content));
->header('Content-Length', (string)strlen($content))
;
return $response;
}
throw new FireflyException('Could not find the indicated attachment. The file is no longer there.');
}
/**
* Edit an attachment.
*
* @param Request $request
* @param Attachment $attachment
*
* @return Factory|View
*/
public function edit(Request $request, Attachment $attachment)
@@ -181,11 +170,6 @@ class AttachmentController extends Controller
/**
* Update attachment.
*
* @param AttachmentFormRequest $request
* @param Attachment $attachment
*
* @return RedirectResponse
*/
public function update(AttachmentFormRequest $request, Attachment $attachment): RedirectResponse
{
@@ -209,9 +193,6 @@ class AttachmentController extends Controller
/**
* View attachment in browser.
*
* @param Attachment $attachment
*
* @return LaravelResponse
* @throws FireflyException
* @throws BindingResolutionException
*/
@@ -239,10 +220,11 @@ class AttachmentController extends Controller
[
'Content-Security-Policy' => implode('; ', $csp),
'Content-Type' => $attachment->mime,
'Content-Disposition' => 'inline; filename="' . $attachment->filename . '"',
'Content-Disposition' => 'inline; filename="'.$attachment->filename.'"',
]
);
}
throw new FireflyException('Could not find the indicated attachment. The file is no longer there.');
}
}