| Conditions | 4 |
| Paths | 6 |
| Total Lines | 21 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 23 | public function getPalette() |
||
| 24 | { |
||
| 25 | switch ($this->getColorSpace()) { |
||
| 26 | default: |
||
| 27 | $palette = new Palette\RGB(); |
||
| 28 | break; |
||
| 29 | case ColorSpace::COLOR_SPACE_CMYK: |
||
| 30 | $palette = new Palette\CMYK(); |
||
| 31 | break; |
||
| 32 | case ColorSpace::COLOR_SPACE_GRAYSCALE: |
||
| 33 | $palette = new Palette\Grayscale(); |
||
| 34 | break; |
||
| 35 | } |
||
| 36 | |||
| 37 | $colorProfile = $this->getColorProfile(); |
||
| 38 | if (null !== $colorProfile) { |
||
| 39 | $palette->setColorProfile($colorProfile); |
||
| 40 | } |
||
| 41 | |||
| 42 | return $palette; |
||
| 43 | } |
||
| 44 | |||
| 64 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: