示例#1
0
 /**
  * create children Card from scope
  * 
  * @param Crawler $node
  * @param string url
  * @return iCard
  */
 private function subCardGeneration(Crawler $node, $url)
 {
     $generator = new CardGenerator();
     try {
         $type = $this->getCardTypeFromCrawler($node);
         $child = $generator->createCard($type);
     } catch (\RuntimeException $e) {
         $child = $generator->createCard('Thing');
     }
     $child->url = $url;
     $child->child = count($node->filter('[itemscope]')) - 1;
     $this->manageItemIdProperty($node, $child);
     $this->getScopeContent($node, $child);
     return $child;
 }
示例#2
0
 public function setUp()
 {
     $this->MDCrawler = MicroDataCrawler::newInstance();
     $cg = new CardGenerator();
     $this->card = $cg->createCard('Thing');
 }