| Conditions | 5 |
| Paths | 5 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | public static function save(string $format, $layout, string $name): string |
||
| 29 | { |
||
| 30 | if ($format === Format::JPEG) { |
||
| 31 | return imagejpeg($layout, $name); |
||
| 32 | } |
||
| 33 | |||
| 34 | if ($format === Format::PNG) { |
||
| 35 | return imagepng($layout, $name); |
||
| 36 | } |
||
| 37 | |||
| 38 | if ($format === Format::GIF) { |
||
| 39 | return imagegif($layout, $name); |
||
| 40 | } |
||
| 41 | |||
| 42 | if ($format === Format::WEBP) { |
||
| 43 | return imagewebp($layout, $name); |
||
| 44 | } |
||
| 45 | |||
| 46 | throw new \Exception("Image type [{$format}] not supported."); |
||
| 47 | } |
||
| 48 | } |