function UpdateFetcher::__construct

Same name in other branches
  1. 9 core/modules/update/src/UpdateFetcher.php \Drupal\update\UpdateFetcher::__construct()
  2. 8.9.x core/modules/update/src/UpdateFetcher.php \Drupal\update\UpdateFetcher::__construct()
  3. 11.x core/modules/update/src/UpdateFetcher.php \Drupal\update\UpdateFetcher::__construct()

Constructs an UpdateFetcher.

Parameters

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The config factory.

\GuzzleHttp\ClientInterface $http_client: A Guzzle client object.

\Drupal\Core\Site\Settings $settings: The settings instance.

\Psr\Log\LoggerInterface|null $logger: The logger.

File

core/modules/update/src/UpdateFetcher.php, line 65

Class

UpdateFetcher
Fetches project information from remote locations.

Namespace

Drupal\update

Code

public function __construct(ConfigFactoryInterface $config_factory, ClientInterface $http_client, Settings $settings, ?LoggerInterface $logger = NULL) {
    $this->fetchUrl = $config_factory->get('update.settings')
        ->get('fetch.url');
    $this->httpClient = $http_client;
    $this->updateSettings = $config_factory->get('update.settings');
    $this->withHttpFallback = $settings->get('update_fetch_with_http_fallback', FALSE);
    if ($this->logger === NULL) {
        @trigger_error('Calling ' . __METHOD__ . '() without the $logger argument is deprecated in drupal:10.1.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/2932520', E_USER_DEPRECATED);
        $this->logger = \Drupal::service('logger.channel.update');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.