You are here

public static function BackendFactory::get in Acquia Purge 8

Get a instantiated Platform CDN purger backend.

Parameters

\Drupal\acquia_purge\AcquiaCloud\PlatformInfoInterface $platforminfo: Information object interfacing with the Acquia platform.

\Drupal\purge\Logger\LoggerChannelPartInterface $logger: The logger passed to the Platform CDN purger.

\Drupal\acquia_purge\Plugin\Purge\Purger\DebuggerInterface $debugger: The centralized debugger for Acquia purger plugins.

\GuzzleHttp\ClientInterface $http_client: An HTTP client that can perform remote requests.

Return value

null|\Drupal\acquia_purge\AcquiaPlatformCdn\BackendInterface The instantiated backend or NULL in case of failure.

1 call to BackendFactory::get()
AcquiaPlatformCdnPurger::initializeBackend in src/Plugin/Purge/Purger/AcquiaPlatformCdnPurger.php
Lazy load the underlying backend based on PlatformInfo CDN configuration.

File

src/AcquiaPlatformCdn/BackendFactory.php, line 39

Class

BackendFactory
Provides a backend for the Platform CDN purger.

Namespace

Drupal\acquia_purge\AcquiaPlatformCdn

Code

public static function get(PlatformInfoInterface $platforminfo, LoggerChannelPartInterface $logger, DebuggerInterface $debugger, ClientInterface $http_client) {
  if (!($backend_config = self::getConfig($platforminfo))) {
    return NULL;
  }
  if (!($backend_class = self::getClassFromConfig($backend_config))) {
    return NULL;
  }
  if (!$backend_class::validateConfiguration($backend_config)) {
    return NULL;
  }
  return new $backend_class($backend_config, $platforminfo, $logger, $debugger, $http_client);
}