コード例 #1
0
ファイル: WordTest.php プロジェクト: ptrofimov/inml
 /**
  * @dataProvider dataProviderTestParse
  */
 public function testParse($string, $getWord, array $getStyles, $hasWord, $hasStyles, $isStyle)
 {
     $word = new Word($string);
     $this->assertSame($string, $word->getRawString());
     $this->assertSame($getWord, $word->getWord());
     $this->assertSame($getStyles, $word->getStyles());
     $this->assertSame($hasWord, $word->hasWord());
     $this->assertSame($hasStyles, $word->hasStyles());
     $this->assertSame($isStyle, $word->isStyle());
 }
コード例 #2
0
ファイル: Line.php プロジェクト: ptrofimov/inml
 /**
  * Constructor
  *
  * @param string $string String to parse
  */
 public function __construct($string)
 {
     $this->rawString = $string;
     $parts = explode(self::CHAR_WORD, $string);
     foreach ($parts as $item) {
         $word = new Word($item);
         if ($word->isStyle()) {
             $this->styles = array_merge($this->styles, $word->getStyles());
         } elseif ($word->hasWord()) {
             $this->words[] = $word;
         }
     }
 }