You are here

public function Credentials::__construct in Apigee Edge 8

Credentials constructor.

Parameters

\Drupal\key\KeyInterface $key: The key entity which stores the API credentials.

Throws

\InvalidArgumentException An InvalidArgumentException is thrown if the key type does not implement EdgeKeyTypeInterface.

2 calls to Credentials::__construct()
HybridCredentials::__construct in src/Connector/HybridCredentials.php
HybridCredentials constructor.
OauthCredentials::__construct in src/OauthCredentials.php
OauthCredentials constructor.
2 methods override Credentials::__construct()
HybridCredentials::__construct in src/Connector/HybridCredentials.php
HybridCredentials constructor.
OauthCredentials::__construct in src/OauthCredentials.php
OauthCredentials constructor.

File

src/Credentials.php, line 57

Class

Credentials
The API credentials.

Namespace

Drupal\apigee_edge

Code

public function __construct(KeyInterface $key) {
  if (!($key_type = $key
    ->getKeyType()) instanceof EdgeKeyTypeInterface) {
    throw new \InvalidArgumentException("Type of {$key->id()} key does not implement EdgeKeyTypeInterface.");
  }
  $this->key = $key;
  $this->keyType = $key_type;
}