You are here

class FeedsHTTPFetcherResult in Feeds 8.2

Result of FeedsHTTPFetcher::fetch().

Hierarchy

Expanded class hierarchy of FeedsHTTPFetcherResult

1 file declares its use of FeedsHTTPFetcherResult
FeedsHTTPFetcher.php in lib/Drupal/feeds/Plugin/feeds/fetcher/FeedsHTTPFetcher.php
Contains \Drupal\feeds\Plugin\feeds\fetcher\FeedsHTTPFetcher.

File

lib/Drupal/feeds/FeedsHTTPFetcherResult.php, line 8

Namespace

Drupal\feeds
View source
class FeedsHTTPFetcherResult extends FeedsFetcherResult {
  protected $url;
  protected $file_path;
  protected $timeout;

  /**
   * Constructor.
   */
  public function __construct($url = NULL) {
    $this->url = $url;
    parent::__construct('');
  }

  /**
   * Overrides FeedsFetcherResult::getRaw();
   */
  public function getRaw() {
    feeds_include_library('http_request.inc', 'http_request');
    $result = http_request_get($this->url, NULL, NULL, NULL, $this->timeout);
    if (!in_array($result->code, array(
      200,
      201,
      202,
      203,
      204,
      205,
      206,
    ))) {
      throw new \Exception(t('Download of @url failed with code !code.', array(
        '@url' => $this->url,
        '!code' => $result->code,
      )));
    }
    return $this
      ->sanitizeRaw($result->data);
  }
  public function getTimeout() {
    return $this->timeout;
  }
  public function setTimeout($timeout) {
    $this->timeout = $timeout;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FeedsFetcherResult::$raw protected property
FeedsFetcherResult::getFilePath public function Get a path to a temporary file containing the resource provided by the fetcher. 1
FeedsFetcherResult::sanitizeFile public function Sanitize the file in place. Currently supported sanitizations:
FeedsFetcherResult::sanitizeRaw public function Sanitize the raw content string. Currently supported sanitizations:
FeedsHTTPFetcherResult::$file_path protected property Overrides FeedsFetcherResult::$file_path
FeedsHTTPFetcherResult::$timeout protected property
FeedsHTTPFetcherResult::$url protected property
FeedsHTTPFetcherResult::getRaw public function Overrides FeedsFetcherResult::getRaw(); Overrides FeedsFetcherResult::getRaw
FeedsHTTPFetcherResult::getTimeout public function
FeedsHTTPFetcherResult::setTimeout public function
FeedsHTTPFetcherResult::__construct public function Constructor. Overrides FeedsFetcherResult::__construct