/** * @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); }
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; } }
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; } }