예제 #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;
         }
     }
 }