| Conditions | 3 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | public function __construct(string $path, ?string $filename = null) |
||
| 16 | 4 | { |
|
| 17 | if (!file_exists($path)) { |
||
| 18 | 4 | throw new LogicException(sprintf('Image %s does not exist.', $path)); |
|
| 19 | 1 | } |
|
| 20 | |||
| 21 | if (exif_imagetype($path) !== IMAGETYPE_PNG) { |
||
| 22 | 3 | throw new LogicException('Image should be of type PNG.'); |
|
| 23 | 3 | } |
|
| 24 | 1 | ||
| 25 | $this->path = $path; |
||
| 26 | $this->filename = $filename ?? basename($path); |
||
| 27 | } |
||
| 49 |