You are here

public function ClientManager::__construct in Acquia Content Hub 8

ClientManager constructor.

Parameters

\Drupal\Core\Logger\LoggerChannelFactoryInterface $logger_factory: The logger factory.

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

\Drupal\Core\Language\LanguageManagerInterface $language_manager: The language manager.

\Drupal\acquia_contenthub\Middleware\MiddlewareCollector $collector: The middleware.

\Drupal\Core\Extension\ModuleExtensionList $module_extension_list: The module extension list.

File

src/Client/ClientManager.php, line 90

Class

ClientManager
Provides a service for managing pending server tasks.

Namespace

Drupal\acquia_contenthub\Client

Code

public function __construct(LoggerChannelFactoryInterface $logger_factory, ConfigFactoryInterface $config_factory, LanguageManagerInterface $language_manager, MiddlewareCollector $collector, ModuleExtensionList $module_extension_list) {
  $this->loggerFactory = $logger_factory;

  // Set the client user agent.
  // phpcs:ignore
  $module_info = array_merge($module_extension_list
    ->getAllInstalledInfo()['acquia_contenthub'], [
    'version' => '0.0.0',
    'core' => '0.0.0',
  ]);
  $this->clientUserAgent = 'AcquiaContentHub/' . $module_info['core'] . '-' . $module_info['version'];
  $this->configFactory = $config_factory;
  $this->languageManager = $language_manager;
  $this->collector = $collector;

  // Get the content hub config settings.
  $this->config = $this->configFactory
    ->get('acquia_contenthub.admin_settings');

  // Initializing Client.
  $this
    ->setConnection();
}