You are here

public function ContentHubConnectionManager::checkClient in Acquia Content Hub 8.2

Check if client successfully registered.

Check client first if needed before any action.

Return value

$this Returns itself for the sake of chainability.

Throws

\RuntimeException

\Exception

File

src/ContentHubConnectionManager.php, line 355

Class

ContentHubConnectionManager
Responsible for connection management actions.

Namespace

Drupal\acquia_contenthub

Code

public function checkClient() : self {
  $this
    ->initialize();
  if (is_null($this->client)) {
    throw new \RuntimeException('Client is not configured.');
  }
  $resp = $this->client
    ->ping();
  if (!empty($resp)) {
    throw new \RuntimeException('Client could not reach Content Hub.');
  }
  return $this;
}