You are here

public function StatusController::getIdFromSub in Acquia Connector 8

Same name and namespace in other branches
  1. 8.2 src/Controller/StatusController.php \Drupal\acquia_connector\Controller\StatusController::getIdFromSub()
  2. 3.x src/Controller/StatusController.php \Drupal\acquia_connector\Controller\StatusController::getIdFromSub()

Gets the subscription UUID from subscription data.

Parameters

array $sub_data: An array of subscription data.

Return value

string The UUID taken from the subscription data.

See also

acquia_agent_settings('acquia_subscription_data')

1 call to StatusController::getIdFromSub()
StatusController::access in src/Controller/StatusController.php
Access callback for json() callback.

File

src/Controller/StatusController.php, line 107

Class

StatusController
Checks the current status of the Acquia Service.

Namespace

Drupal\acquia_connector\Controller

Code

public function getIdFromSub(array $sub_data) {
  if (!empty($sub_data['uuid'])) {
    return $sub_data['uuid'];
  }

  // Otherwise, get this form the sub url.
  $url = UrlHelper::parse($sub_data['href']);
  $parts = explode('/', $url['path']);

  // Remove '/dashboard'.
  array_pop($parts);
  return end($parts);
}