public static function toLab(Space\ColorInterface $color) { $class = get_class($color); if ($class == 'Pop\\Color\\Space\\Lab') { throw new Exception('That color space object is already that type.'); } $type = strtolower(substr($class, strrpos($class, '\\') + 1)); $method = $type . 'ToLab'; return self::$method($color); }
public function testHsbToLab() { $lab = Convert::toLab(new Hsb(180, 50, 50)); $this->assertInstanceOf('Pop\\Color\\Space\\Lab', $lab); $this->assertEquals('48,-34,28', (string) $lab); }