Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
UploadedFile
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
4
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getFile
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getStream
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2namespace Apie\IntegrationTests\Apie\TypeDemo\Resources;
3
4use Apie\Core\Attributes\AllowMultipart;
5use Apie\Core\Attributes\FakeCount;
6use Apie\Core\Attributes\RemovalCheck;
7use Apie\Core\Attributes\ResourceName;
8use Apie\Core\Attributes\StaticCheck;
9use Apie\Core\Entities\EntityInterface;
10use Apie\Core\FileStorage\ImageFile;
11use Apie\IntegrationTests\Apie\TypeDemo\Identifiers\UploadedFileIdentifier;
12use Psr\Http\Message\UploadedFileInterface;
13
14#[RemovalCheck(new StaticCheck())]
15#[ResourceName('File')]
16#[FakeCount(1)]
17#[AllowMultipart]
18final 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}