本文整理汇总了PHP中Style::getDocument方法的典型用法代码示例。如果您正苦于以下问题:PHP Style::getDocument方法的具体用法?PHP Style::getDocument怎么用?PHP Style::getDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Style
的用法示例。
在下文中一共展示了Style::getDocument方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: merge
/**
* Merges two styles
*
* Every element has a cloned style object. However, the style will usually
* change very litte element-to-element. Thus, it's a waste of space to have
* hundreds of identical objects in memory.
*
* I'll merge this style object with $style. If a state is identical between
* the two, I'll set this style's property to reference $style's property.
*
* @param Jstewmc\Rtf\Style $style the reference style
* @return self
* @since 0.1.0
*/
public function merge(Style $style)
{
if ($style->getDocument() == $this->document) {
$this->document = $style->getDocument();
}
if ($style->getSection() == $this->section) {
$this->section = $style->getSection();
}
if ($style->getParagraph() == $this->paragraph) {
$this->paragraph = $style->getParagraph();
}
if ($style->getCharacter() == $this->character) {
$this->character = $style->getCharacter();
}
return;
}
示例2: testMerge_doesMergeStyles_ifStatesAreSame
/**
* merge() should merge styles if the states are the same
*/
public function testMerge_doesMergeStyles_ifStatesAreSame()
{
$style1 = new Style();
$style2 = new Style();
$style2->merge($style1);
$this->assertSame($style1->getDocument(), $style2->getDocument());
$this->assertSame($style1->getSection(), $style2->getSection());
$this->assertSame($style1->getParagraph(), $style2->getParagraph());
$this->assertSame($style1->getCharacter(), $style2->getCharacter());
return;
}