public createParagraph ( ) : |
||
리턴 |
public function createParagraph()
{
$numParagraphs = count($this->richTextParagraphs);
if ($numParagraphs > 0) {
$alignment = clone $this->getActiveParagraph()->getAlignment();
$font = clone $this->getActiveParagraph()->getFont();
$bulletStyle = clone $this->getActiveParagraph()->getBulletStyle();
}
$this->richTextParagraphs[] = new Paragraph();
$this->activeParagraph = count($this->richTextParagraphs) - 1;
if (isset($alignment)) {
$this->getActiveParagraph()->setAlignment($alignment);
}
if (isset($font)) {
$this->getActiveParagraph()->setFont($font);
}
if (isset($bulletStyle)) {
$this->getActiveParagraph()->setBulletStyle($bulletStyle);
}
return $this->getActiveParagraph();
}
public function testActiveParagraph() { $object = new RichText(); $this->assertEquals(0, $object->getActiveParagraphIndex()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->createParagraph()); $this->assertCount(2, $object->getParagraphs()); $value = rand(0, 1); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->setActiveParagraph($value)); $this->assertEquals($value, $object->getActiveParagraphIndex()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->getActiveParagraph()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->getParagraph()); $value = rand(0, 1); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->getParagraph($value)); }