Пример #1
0
 /**
  * @param SimpleXMLElement $xml
  * @param Feeds $feeds
  * @param Tags $tags
  * @return void
  */
 public function process(SimpleXMLElement $xml, Feeds $feeds, Tags $tags)
 {
     $title = (string) $xml->attributes()->text;
     foreach ($xml->outline as $outline) {
         $type = (string) $outline->attributes()->type;
         if ($type == 'rss') {
             $result = $feeds->insert((string) $outline->attributes()->text, (string) $outline->attributes()->xmlUrl, (string) $outline->attributes()->htmlUrl);
             if ($result && $title) {
                 $tags->insert($title, $feeds->lastInsertId());
             }
         } else {
             $this->process($outline, $feeds, $tags);
         }
     }
 }