Newer
Older
Angie Byron
committed
<?php
/**
* @file
* Contains \Drupal\aggregator_test\Plugin\aggregator\fetcher\TestFetcher.
*/
namespace Drupal\aggregator_test\Plugin\aggregator\fetcher;
use Drupal\aggregator\Plugin\FetcherInterface;
use Drupal\aggregator\Plugin\aggregator\fetcher\DefaultFetcher;
use Drupal\aggregator\Entity\Feed;
Dries Buytaert
committed
use Drupal\aggregator\Annotation\AggregatorFetcher;
Angie Byron
committed
use Drupal\Core\Annotation\Translation;
use Guzzle\Http\Exception\BadResponseException;
/**
* Defines a test fetcher implementation.
*
* Uses http_default_client class to download the feed.
*
Dries Buytaert
committed
* @AggregatorFetcher(
Angie Byron
committed
* id = "aggregator_test_fetcher",
* title = @Translation("Test fetcher"),
* description = @Translation("Dummy fetcher for testing purposes.")
* )
*/
class TestFetcher extends DefaultFetcher implements FetcherInterface {
/**
* Implements \Drupal\aggregator\Plugin\FetcherInterface::fetch().
*/
public function fetch(Feed $feed) {
if ($feed->label() == 'Do not fetch') {
return FALSE;
}
return parent::fetch($feed);
}
}