You are here

protected function Entry::populateData in Feeds 8.3

Populates the georss data.

1 call to Entry::populateData()
Entry::getGeoPoints in src/Zend/Extension/Georss/Entry.php
Get the entry points.

File

src/Zend/Extension/Georss/Entry.php, line 42

Class

Entry
Parses GeoRss data.

Namespace

Drupal\feeds\Zend\Extension\Georss

Code

protected function populateData() {
  $this->data['georss'] = [];
  $list = $this->xpath
    ->evaluate($this
    ->getXpathPrefix() . '//georss:point');
  foreach ($list as $point) {

    // Normalize whitespace.
    $parts = explode(' ', preg_replace('/\\s+/', ' ', trim($point->nodeValue)));
    if (count($parts) === 2) {
      $this->data['georss'][] = [
        'lat' => is_numeric($parts[0]) ? (double) $parts[0] : NULL,
        'lon' => is_numeric($parts[1]) ? (double) $parts[1] : NULL,
      ];
    }
  }
}