コード例 #1
0
 public function extractAuthor(Crawler $crawler)
 {
     $ret = $this->getElementText($crawler, $this->authorSelector);
     if (empty($ret) === true) {
         $ret = $this->fallbackAdapter->extractAuthor($crawler);
     }
     return $ret;
 }
コード例 #2
0
 public function testExtractAuthor()
 {
     $crawler = new Crawler($this->getHtmlContent());
     $adapter = new Adapters\DefaultAdapter();
     $author = $adapter->extractAuthor($crawler);
     $this->assertEquals('Mr. HTML', $author);
 }