You are here

protected function SDKConnector::userAgentPrefix in Apigee Edge 8

Generates a custom user agent prefix.

1 call to SDKConnector::userAgentPrefix()
SDKConnector::buildClient in src/SDKConnector.php
Returns a pre-configured API client with the provided credentials.

File

src/SDKConnector.php, line 251

Class

SDKConnector
Provides an Apigee Edge SDK connector.

Namespace

Drupal\apigee_edge

Code

protected function userAgentPrefix() : string {
  if (NULL === self::$userAgentPrefix) {
    $module_info = $this->infoParser
      ->parse($this->moduleHandler
      ->getModule('apigee_edge')
      ->getPathname());
    if (!isset($module_info['version'])) {
      $module_info['version'] = '8.x-1.x-dev';
    }

    // TODO Change "DevPortal" to "Drupal module" later. It has been added for
    // Apigee's convenience this way.
    self::$userAgentPrefix = $module_info['name'] . ' DevPortal ' . $module_info['version'];
  }
  return self::$userAgentPrefix;
}