Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
UploadedFile | |
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
4 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getFile | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getStream | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | namespace Apie\IntegrationTests\Apie\TypeDemo\Resources; |
3 | |
4 | use Apie\Core\Attributes\AllowMultipart; |
5 | use Apie\Core\Attributes\FakeCount; |
6 | use Apie\Core\Attributes\RemovalCheck; |
7 | use Apie\Core\Attributes\ResourceName; |
8 | use Apie\Core\Attributes\StaticCheck; |
9 | use Apie\Core\Entities\EntityInterface; |
10 | use Apie\Core\FileStorage\ImageFile; |
11 | use Apie\IntegrationTests\Apie\TypeDemo\Identifiers\UploadedFileIdentifier; |
12 | use Psr\Http\Message\UploadedFileInterface; |
13 | |
14 | #[RemovalCheck(new StaticCheck())] |
15 | #[ResourceName('File')] |
16 | #[FakeCount(1)] |
17 | #[AllowMultipart] |
18 | final class UploadedFile implements EntityInterface |
19 | { |
20 | public function __construct( |
21 | private UploadedFileIdentifier $id, |
22 | private UploadedFileInterface $file, |
23 | public ?ImageFile $imageFile = null |
24 | ) { |
25 | } |
26 | |
27 | public function getId(): UploadedFileIdentifier |
28 | { |
29 | return $this->id; |
30 | } |
31 | |
32 | public function getFile(): UploadedFileInterface |
33 | { |
34 | return $this->file; |
35 | } |
36 | |
37 | public function getStream(): mixed |
38 | { |
39 | return $this->file->getStream()->detach(); |
40 | } |
41 | } |