Conditions | 5 |
Paths | 5 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
7 | public static function create(string $format, string $path) |
||
8 | { |
||
9 | if ($format === Format::JPEG) { |
||
10 | return imagecreatefromjpeg($path); |
||
11 | } |
||
12 | |||
13 | if ($format === Format::PNG) { |
||
14 | return imagecreatefrompng($path); |
||
15 | } |
||
16 | |||
17 | if ($format === Format::GIF) { |
||
18 | return imagecreatefromgif($path); |
||
19 | } |
||
20 | |||
21 | if ($format === Format::WEBP) { |
||
22 | return imagecreatefromwebp($path); |
||
23 | } |
||
24 | |||
25 | throw new \Exception("Image type [{$format}] not supported."); |
||
26 | } |
||
27 | |||
48 | } |