You are here

public function Client::__construct in Acquia Connector 8.2

Same name and namespace in other branches
  1. 8 src/Client.php \Drupal\acquia_connector\Client::__construct()
  2. 3.x src/Client.php \Drupal\acquia_connector\Client::__construct()

Client constructor.

Parameters

\Drupal\Core\Config\ConfigFactoryInterface $configFactory: Config Factory Interface.

\Drupal\Core\State\StateInterface $state: The state service.

1 method overrides Client::__construct()
ClientTest::__construct in tests/src/Unit/AcquiaConnectorUnitTest.php
Construction method.

File

src/Client.php, line 76

Class

Client
Acquia connector client.

Namespace

Drupal\acquia_connector

Code

public function __construct(ConfigFactoryInterface $configFactory, StateInterface $state) {
  $this->configFactory = $configFactory;
  $this->config = $configFactory
    ->get('acquia_connector.settings');
  $this->server = $this->config
    ->get('spi.server');
  $this->state = $state;
  $this->headers = [
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
  ];
  $this->client = \Drupal::service('http_client_factory')
    ->fromOptions([
    'verify' => (bool) $this->config
      ->get('spi.ssl_verify'),
    'http_errors' => FALSE,
  ]);
}