當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Style::getCharacter方法代碼示例

本文整理匯總了PHP中Style::getCharacter方法的典型用法代碼示例。如果您正苦於以下問題:PHP Style::getCharacter方法的具體用法?PHP Style::getCharacter怎麽用?PHP Style::getCharacter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Style的用法示例。


在下文中一共展示了Style::getCharacter方法的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;
 }
開發者ID:jstewmc,項目名稱:rtf,代碼行數:30,代碼來源:Style.php

示例2: testMerge_doesNotMergeStyles_ifStatesAreDifferent

 /**
  * merge() should not merge style if the states are different
  */
 public function testMerge_doesNotMergeStyles_ifStatesAreDifferent()
 {
     $style1 = new Style();
     $style2 = new Style();
     // $style2->getDocument()->setSomething();
     $style2->getSection()->setIndex(999);
     $style2->getParagraph()->setIndex(999);
     $style2->getCharacter()->setIsBold(true);
     $style2->merge($style1);
     // $this->assertNotSame($style1->getDocument(), $style2->getDocument());
     $this->assertNotSame($style1->getSection(), $style2->getSection());
     $this->assertNotSame($style1->getParagraph(), $style2->getParagraph());
     $this->assertNotSame($style1->getCharacter(), $style2->getCharacter());
     return;
 }
開發者ID:jstewmc,項目名稱:rtf,代碼行數:18,代碼來源:StyleTest.php


注:本文中的Style::getCharacter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。