Conditions | 3 |
Paths | 3 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
42 | protected function formatImageData($data, $format, $quality = null) |
||
43 | { |
||
44 | if (!isset($this->formats[$format])) { |
||
45 | throw new \InvalidArgumentException(sprintf( |
||
46 | 'Unsupported format %s. Supported formats are: %s', |
||
47 | $format, |
||
48 | implode(', ', array_keys($this->formats)) |
||
49 | )); |
||
50 | } |
||
51 | |||
52 | $params = array($data); |
||
53 | if (null !== $quality) { |
||
54 | $params[] = null; |
||
55 | $params[] = $quality; |
||
56 | } |
||
57 | |||
58 | ob_start(); |
||
59 | call_user_func_array($this->formats[$format], $params); |
||
60 | $formatted = ob_get_clean(); |
||
61 | |||
62 | return $formatted; |
||
63 | } |
||
64 | } |
||
65 |