You are here

protected function DataParserPluginBase::nextSource in Migrate Plus 8.3

Same name and namespace in other branches
  1. 8.5 src/DataParserPluginBase.php \Drupal\migrate_plus\DataParserPluginBase::nextSource()
  2. 8 src/DataParserPluginBase.php \Drupal\migrate_plus\DataParserPluginBase::nextSource()
  3. 8.2 src/DataParserPluginBase.php \Drupal\migrate_plus\DataParserPluginBase::nextSource()
  4. 8.4 src/DataParserPluginBase.php \Drupal\migrate_plus\DataParserPluginBase::nextSource()

Advances the data parser to the next source url.

Return value

bool TRUE if a valid source URL was opened

1 call to DataParserPluginBase::nextSource()
DataParserPluginBase::next in src/DataParserPluginBase.php
Implementation of Iterator::next().

File

src/DataParserPluginBase.php, line 150

Class

DataParserPluginBase
Defines a base data parser implementation.

Namespace

Drupal\migrate_plus

Code

protected function nextSource() {
  while ($this->activeUrl === NULL || count($this->urls) - 1 > $this->activeUrl) {
    if (is_null($this->activeUrl)) {
      $this->activeUrl = 0;
    }
    else {

      // Increment the activeUrl so we try to load the next source.
      $this->activeUrl = $this->activeUrl + 1;
      if ($this->activeUrl >= count($this->urls)) {
        return FALSE;
      }
    }
    if ($this
      ->openSourceUrl($this->urls[$this->activeUrl])) {

      // We have a valid source.
      return TRUE;
    }
  }
  return FALSE;
}