AttachmentProxy::download()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Mostafaznv\Larupload\Storage\Proxy;
4
5
use Illuminate\Http\UploadedFile;
6
use Mostafaznv\Larupload\Larupload;
7
use Illuminate\Http\RedirectResponse;
8
use Mostafaznv\Larupload\Storage\Attachment;
9
use Symfony\Component\HttpFoundation\StreamedResponse;
10
11
class AttachmentProxy
12
{
13
    public function __construct(private readonly Attachment $attachment) {}
14
15
    public function attach(mixed $file, ?UploadedFile $cover = null): bool
16
    {
17
        return $this->attachment->attach($file, $cover);
18
    }
19
20
    public function detach(): bool
21
    {
22
        return $this->attachment->detach();
23
    }
24
25
    public function cover(): AttachmentCover
26
    {
27
        return new AttachmentCover($this->attachment);
28
    }
29
30
    public function meta(?string $key = null): object|int|string|null
31
    {
32
        return $this->attachment->meta($key);
33
    }
34
35
    public function urls(): object
36
    {
37
        return $this->attachment->urls();
38
    }
39
40
    public function url(string $style = Larupload::ORIGINAL_FOLDER): ?string
41
    {
42
        return $this->attachment->url($style);
43
    }
44
45
    public function download(string $style = Larupload::ORIGINAL_FOLDER): StreamedResponse|RedirectResponse|null
46
    {
47
        return $this->attachment->download($style);
48
    }
49
50
    public function handleFFMpegQueue(bool $isLastOne = false): void
51
    {
52
        $this->attachment->handleFFMpegQueue($isLastOne);
53
    }
54
}
55