コード例 #1
0
 /**
  * @inheritdoc
  */
 public function getPublicationDate()
 {
     return SelectorBuilder::create()->setSelectorKey('article .article-header .byline time.timestamp')->setSelectorType(SelectorBuilder::NODE_ATTR)->setSelectorAttr('datetime');
 }
コード例 #2
0
 /**
  * @inheritdoc
  */
 public function getTwitter()
 {
     return SelectorBuilder::create()->setSelectorKey('article .article-header .twitter-handle a')->setSelectorType(SelectorBuilder::NODE_TEXT);
 }
コード例 #3
0
 public function getSelectorAttr()
 {
     $selector = SelectorBuilder::create()->setSelectorType(SelectorBuilder::NODE_ATTR)->setSelectorAttr('fakeproperty');
     $this->assertEquals(SelectorBuilder::NODE_ATTR, $selector->getSelectorType());
     $this->assertEquals('fakeproperty', $selector->getSelectorAttr());
 }
コード例 #4
0
 /**
  * @inheritdoc
  */
 public function getCanonical()
 {
     return SelectorBuilder::create()->setSelectorKey('link[rel="canonical"]')->setSelectorType(SelectorBuilder::NODE_ATTR)->setSelectorAttr('href');
 }
コード例 #5
0
 /**
  * @inheritdoc
  */
 public function getCustomMeta($selectorKey, $selectorAttr)
 {
     return SelectorBuilder::create()->setSelectorKey(sprintf('meta[%s]', $selectorKey))->setSelectorType(SelectorBuilder::NODE_ATTR)->setSelectorAttr($selectorAttr);
 }