Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
ImageFile
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 validateState
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2namespace Apie\Core\FileStorage;
3
4use Apie\Core\Attributes\FakeFile;
5use Apie\Core\Exceptions\InvalidTypeException;
6use Apie\Faker\Interfaces\ApieImageFileFaker;
7
8#[FakeFile(ApieImageFileFaker::class)]
9final 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}