public static function toRgb(Space\ColorInterface $color) { $class = get_class($color); if ($class == 'Pop\\Color\\Space\\Rgb') { throw new Exception('That color space object is already that type.'); } $type = strtolower(substr($class, strrpos($class, '\\') + 1)); $method = $type . 'ToRgb'; return self::$method($color); }
public function testLabToRgb() { $rgb = Convert::toRgb(new Lab(100, 100, 100)); $this->assertInstanceOf('Pop\\Color\\Space\\Rgb', $rgb); $this->assertEquals('195,146,49', (string) $rgb); }