class TestFetcher in Drupal 8
Same name and namespace in other branches
- 9 core/modules/aggregator/tests/modules/aggregator_test/src/Plugin/aggregator/fetcher/TestFetcher.php \Drupal\aggregator_test\Plugin\aggregator\fetcher\TestFetcher
Defines a test fetcher implementation.
Uses http_client class to download the feed.
Plugin annotation
@AggregatorFetcher(
id = "aggregator_test_fetcher",
title = @Translation("Test fetcher"),
description = @Translation("Dummy fetcher for testing purposes.")
)
Hierarchy
- class \Drupal\aggregator\Plugin\aggregator\fetcher\DefaultFetcher implements FetcherInterface, ContainerFactoryPluginInterface
- class \Drupal\aggregator_test\Plugin\aggregator\fetcher\TestFetcher implements FetcherInterface
Expanded class hierarchy of TestFetcher
File
- core/
modules/ aggregator/ tests/ modules/ aggregator_test/ src/ Plugin/ aggregator/ fetcher/ TestFetcher.php, line 20
Namespace
Drupal\aggregator_test\Plugin\aggregator\fetcherView source
class TestFetcher extends DefaultFetcher implements FetcherInterface {
/**
* {@inheritdoc}
*/
public function fetch(FeedInterface $feed) {
if ($feed
->label() == 'Do not fetch') {
return FALSE;
}
return parent::fetch($feed);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DefaultFetcher:: |
protected | property | The HTTP client to fetch the feed data with. | |
DefaultFetcher:: |
protected | property | A logger instance. | |
DefaultFetcher:: |
protected | property | The messenger. | |
DefaultFetcher:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
DefaultFetcher:: |
public | function | Constructs a DefaultFetcher object. | |
TestFetcher:: |
public | function |
Downloads feed data. Overrides DefaultFetcher:: |