| Conditions | 3 |
| Paths | 3 |
| Total Lines | 19 |
| 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 | { |
||
| 37 | 1 | $this->filePath = $filePath; |
|
| 38 | 1 | $this->publicPath = $publicPath; |
|
| 39 | |||
| 40 | 1 | if (!file_exists($filePath)) { |
|
| 41 | throw new FileMissingException(sprintf('The file %s does not exist while constructing %s', $filePath, self::class)); |
||
| 42 | } |
||
| 43 | |||
| 44 | 1 | if (false === \exif_imagetype($filePath)) { |
|
| 45 | throw new FileNotImageException(sprintf('The file %s is not an image while constructing %s', $filePath, self::class)); |
||
| 46 | } |
||
| 47 | |||
| 48 | 1 | [$this->width, $this->height] = getimagesize($filePath); |
|
| 49 | 1 | $this->imagineKey= $imagineKey; |
|
| 50 | 1 | } |
|
| 92 |