Pop\Color\Color::addColor PHP Метод

addColor() публичный Метод

Method to add a new color space object to the color object.
public addColor ( Pop\Color\Space\ColorInterface $color ) : Color
$color Pop\Color\Space\ColorInterface
Результат Color
    public function addColor(Space\ColorInterface $color)
    {
        $class = get_class($color);
        $type = strtolower(substr($class, strrpos($class, '\\') + 1));
        $this->colors[$type] = $color;
        if ($type != 'cmyk') {
            $this->colors['cmyk'] = Convert::toCmyk($color);
        }
        if ($type != 'hex') {
            $this->colors['hex'] = Convert::toHex($color);
        }
        if ($type != 'hsb') {
            $this->colors['hsb'] = Convert::toHsb($color);
        }
        if ($type != 'lab') {
            $this->colors['lab'] = Convert::toLab($color);
        }
        if ($type != 'rgb') {
            $this->colors['rgb'] = Convert::toRgb($color);
        }
        ksort($this->colors);
        return $this;
    }