PhpOffice\PhpPresentation\Shape\RichText::setParagraphs PHP Method

setParagraphs() public method

Set paragraphs
public setParagraphs ( Paragraph[] $paragraphs = null ) : RichText
$paragraphs PhpOffice\PhpPresentation\Shape\RichText\Paragraph[] Array of paragraphs
return RichText
    public function setParagraphs($paragraphs = null)
    {
        if (!is_array($paragraphs)) {
            throw new \Exception("Invalid \\PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph[] array passed.");
        }
        $this->richTextParagraphs = $paragraphs;
        $this->activeParagraph = count($this->richTextParagraphs) - 1;
        return $this;
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * @expectedException \Exception
  * expectedExceptionMessage Invalid \PhpOffice\PhpPresentation\Shape\RichText\Paragraph[] array passed.
  */
 public function testParagraphsException()
 {
     $object = new RichText();
     $object->setParagraphs(1000);
 }