public static function toHsb(Space\ColorInterface $color) { $class = get_class($color); if ($class == 'Pop\\Color\\Space\\Hsb') { throw new Exception('That color space object is already that type.'); } $type = strtolower(substr($class, strrpos($class, '\\') + 1)); $method = $type . 'ToHsb'; return self::$method($color); }
public function testLabToHsb() { $hsb = Convert::toHsb(new Lab(100, 100, 100)); $this->assertInstanceOf('Pop\\Color\\Space\\Hsb', $hsb); $this->assertEquals('40,75,76', (string) $hsb); }