Conditions | 3 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3.0987 |
Changes | 0 |
1 | <?php |
||
31 | 1 | public function __construct( |
|
32 | string $filePath, |
||
33 | string $publicPath, |
||
34 | ?string $imagineKey = null |
||
35 | ) { |
||
36 | 1 | $this->filePath = $filePath; |
|
37 | 1 | $this->publicPath = $publicPath; |
|
38 | |||
39 | 1 | if (!file_exists($filePath)) { |
|
40 | throw new FileMissingException(sprintf('The file %s does not exist while constructing %s', $filePath, self::class)); |
||
41 | } |
||
42 | |||
43 | 1 | if (false === \exif_imagetype($filePath)) { |
|
44 | throw new FileNotImageException(sprintf('The file %s is not an image while constructing %s', $filePath, self::class)); |
||
45 | } |
||
46 | |||
47 | 1 | [$this->width, $this->height] = getimagesize($filePath); |
|
48 | 1 | $this->imagineKey= $imagineKey; |
|
49 | 1 | } |
|
91 |