Ejemplo n.º 1
0
 /**
  * @param Item $item
  */
 public function processItem($item)
 {
     $data = $item->getData();
     $replaced = [];
     $replaced[$this->attribute] = str_replace($this->search, $this->replace, $data[$this->attribute]);
     $item->setData($replaced);
 }
Ejemplo n.º 2
0
 public function parseBody($body, $feed)
 {
     $xml = new \SimpleXMLElement($body);
     foreach ($xml->attributes() as $key => $val) {
         $feed->attributes += [$key => $val];
     }
     $feed->namespaces += $xml->getDocNamespaces();
     $metadata = $this->parseChildrenValues($xml->channel);
     unset($metadata['item']);
     $feed->metadata += $metadata;
     foreach ($xml->channel->item as $key => $element) {
         $item = new Item();
         $item->setData($this->parseChildrenValues($element));
         $item->attributes += $this->parseAllAttributes($element);
         $feed->items[] = $item;
     }
 }
Ejemplo n.º 3
0
 public function parseBody($body, $feed)
 {
     $xml = new \SimpleXMLElement($body);
     foreach ($xml->attributes() as $key => $val) {
         $feed->attributes += [$key => $val];
     }
     $feed->namespaces += $xml->getDocNamespaces();
     $metadata = $this->parseChildrenValues($xml);
     unset($metadata['entry']);
     $feed->metadata += $metadata;
     foreach ($xml->entry as $key => $element) {
         $item = new Item();
         $item->guid = (string) $element->id;
         $item->description = (string) $element->content;
         $item->setData($this->parseChildrenValues($element));
         $item->attributes += $this->parseAllAttributes($element);
         $feed->items[] = $item;
     }
 }