You are here

protected function DataParserPluginBase::nextSource in Migrate Plus 8.4

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.3 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

2 calls to DataParserPluginBase::nextSource()
DataParserPluginBase::next in src/DataParserPluginBase.php
Implementation of Iterator::next().
DataParserPluginBaseMock::nextSource in tests/src/Unit/DataParserPluginBaseTest.php
phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod.Found
1 method overrides DataParserPluginBase::nextSource()
DataParserPluginBaseMock::nextSource in tests/src/Unit/DataParserPluginBaseTest.php
phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod.Found

File

src/DataParserPluginBase.php, line 151

Class

DataParserPluginBase
Defines a base data parser implementation.

Namespace

Drupal\migrate_plus

Code

protected function nextSource() {
  if (empty($this->urls)) {
    return FALSE;
  }
  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;
}