示例#1
0
 public function testChunkFilter()
 {
     $this->prepareTextChainForChunk();
     $chunks = $this->textChains->chunkFilter(function ($delimiter, $chunk) {
         if (strpos($delimiter, "warnings") !== false) {
             return [$delimiter => $chunk];
         }
     });
     $this->assertEquals(["[warnings-2015-8-9]" => "warnings  start 1\nsaddaslkdjalk jdaslkj dasklj daskld\ndaslkd jaslkdj aslkj dal dja end 1", "[warnings-2015-8-14]" => "hasan agha gilak"], $chunks);
 }
示例#2
0
 /**
  * @param $fileAddress
  * @return TextChains
  */
 public function text($fileAddress)
 {
     $text = $this->text->setFile(new TextFile($fileAddress));
     $text->getFile()->isSafeForOperations();
     return $text;
 }