Conditions | 3 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
58 | public function withPalette(PaletteInterface $palette) |
||
59 | { |
||
60 | $image = clone $this; |
||
61 | |||
62 | if ($image->getColorSpace() === $palette->getColorSpace()) { |
||
63 | return $image; |
||
64 | } |
||
65 | |||
66 | if (null === $image->getColorProfile()) { |
||
67 | $image = $image->withColorProfile($image->getPalette()->getColorProfile()); |
||
68 | } |
||
69 | |||
70 | $image = $image |
||
71 | ->withColorProfile($palette->getColorProfile()) |
||
72 | ->withColorSpace($palette->getColorSpace()); |
||
73 | |||
74 | return $image; |
||
75 | } |
||
76 | } |
||
77 |