Pop\Color\Space\Cmyk::get PHP Метод

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

Method to get the full CMYK value
public get ( integer $type = Pop\Color\Color::ASSOC_ARRAY ) : string | array
$type integer
Результат string | array
    public function get($type = \Pop\Color\Color::ASSOC_ARRAY)
    {
        $cmyk = null;
        switch ($type) {
            case 1:
                $cmyk = array('c' => $this->cyan, 'm' => $this->magenta, 'y' => $this->yellow, 'k' => $this->black);
                break;
            case 2:
                $cmyk = array($this->cyan, $this->magenta, $this->yellow, $this->black);
                break;
            case 3:
                $cmyk = $this->cyan . ',' . $this->magenta . ',' . $this->yellow . ',' . $this->black;
                break;
        }
        return $cmyk;
    }

Usage Example

Пример #1
0
 public function testGetCmyk()
 {
     $c = new Cmyk(20, 40, 60, 80);
     $this->assertEquals('20,40,60,80', (string) $c);
     $this->assertEquals('20,40,60,80', $c->get(Color::STRING));
     $this->assertEquals(array(20, 40, 60, 80), $c->get(Color::NUM_ARRAY));
     $this->assertEquals(array('c' => 20, 'm' => 40, 'y' => 60, 'k' => 80), $c->get());
 }