Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
ImageFile | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
validateState | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 |
1 | <?php |
2 | namespace Apie\Core\FileStorage; |
3 | |
4 | use Apie\Core\Attributes\FakeFile; |
5 | use Apie\Core\Exceptions\InvalidTypeException; |
6 | use Apie\Faker\Interfaces\ApieImageFileFaker; |
7 | |
8 | #[FakeFile(ApieImageFileFaker::class)] |
9 | final class ImageFile extends StoredFile |
10 | { |
11 | protected function validateState(): void |
12 | { |
13 | $serverMime = $this->getServerMimeType(); |
14 | if (!str_starts_with($serverMime, 'image/')) { |
15 | throw new InvalidTypeException($serverMime, 'image mime type'); |
16 | } |
17 | } |
18 | } |