You are here

protected function FeedsCrawlerPattern::beginFetch in Feeds Crawler 7.2

Called before fetching the next link.

Subclasses can override this to manage state.

Parameters

FeedsSource $source: The feed source.

FeedsState $state: The state object.

Overrides FeedsCrawlerBase::beginFetch

File

src/FeedsCrawlerPattern.php, line 32
Contains FeedsCrawlerPattern.

Class

FeedsCrawlerPattern
Crawls links using a URL pattern.

Code

protected function beginFetch(FeedsSource $source, FeedsState $state) {
  parent::beginFetch($source, $state);
  $source_config = $source
    ->getConfigFor($this) + $this
    ->sourceDefaults();
  if (!isset($state->index)) {
    $state->index = $source_config['initial_index'];
  }
  else {
    $state->index += $source_config['increment'];
  }
}