You are here

public function FeedsSource::state in Feeds 7.2

Return a state object for a given stage. Lazy instantiates new states.

Parameters

string $stage: One of FEEDS_FETCH, FEEDS_PARSE, FEEDS_PROCESS or FEEDS_PROCESS_CLEAR.

Return value

FeedsState|mixed The FeedsState object for the given stage. In theory, this could return something else, if $this->state has been polluted with e.g. integer timestamps.

See also

FeedsSource::$state

2 calls to FeedsSource::state()
FeedsSource::progressImporting in includes/FeedsSource.inc
Report progress as float between 0 and 1. 1 = FEEDS_BATCH_COMPLETE.
FeedsSource::startBackgroundJob in includes/FeedsSource.inc
Background job helper. Starts a background job using the Drupal queue.

File

includes/FeedsSource.inc, line 735
Definition of FeedsSourceInterface, FeedsState and FeedsSource class.

Class

FeedsSource
Holds the source of a feed to import.

Code

public function state($stage) {
  if (!is_array($this->state)) {
    $this->state = array();
  }
  if (!isset($this->state[$stage])) {
    $this->state[$stage] = new FeedsState();
  }
  return $this->state[$stage];
}