PhpOffice\PhpPresentation\Style\Font::setColor PHP Метод

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

Set Color
public setColor ( Color | SchemeColor $pValue = null ) : Font
$pValue Color | SchemeColor
Результат Font
    public function setColor($pValue = null)
    {
        if (!$pValue instanceof Color) {
            throw new \Exception('$pValue must be an instance of \\PhpOffice\\PhpPresentation\\Style\\Color');
        }
        $this->color = $pValue;
        return $this;
    }

Usage Example

Пример #1
0
 /**
  * Test get/set color
  */
 public function testSetGetColor()
 {
     $object = new Font();
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setColor());
     $this->assertNull($object->getColor());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->setColor(new Color(Color::COLOR_BLUE)));
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getColor());
     $this->assertEquals(Color::COLOR_BLUE, $object->getColor()->getARGB());
 }