You are here

protected function ContentHubCommonActions::getClient in Acquia Content Hub 8.2

Gets the client or throws a common exception when it's unavailable.

Return value

\Acquia\ContentHubClient\ContentHubClient|bool The ContentHubClient object or FALSE.

Throws

\Exception

4 calls to ContentHubCommonActions::getClient()
ContentHubCommonActions::deleteRemoteEntity in src/ContentHubCommonActions.php
Delete a remote entity if we own it.
ContentHubCommonActions::getCdfDocument in src/ContentHubCommonActions.php
Retrieves entities and dependencies by uuid and returns a CDFDocument.
ContentHubCommonActions::getRemoteEntity in src/ContentHubCommonActions.php
Get the remote entity CDFObject if available.
ContentHubCommonActions::requestToRepublishEntity in src/ContentHubCommonActions.php
Request to republish an entity via Webhook.

File

src/ContentHubCommonActions.php, line 546

Class

ContentHubCommonActions
Common actions across the entirety of Content Hub.

Namespace

Drupal\acquia_contenthub

Code

protected function getClient() {
  $client = $this->factory
    ->getClient();
  if (!$client instanceof ContentHubClient) {
    $message = "Client is not properly configured. Please check your ContentHub registration credentials.";
    $this->channel
      ->error($message);
    throw new \Exception($message);
  }
  return $client;
}