You are here

public function PrivateFileKeyProvider::realGetKeyValue in Apigee Edge 8

The method that returns a key's value after pre-requirements got validated.

Parameters

\Drupal\key\KeyInterface $key: A key entity.

Overrides KeyProviderRequirementsBase::realGetKeyValue

File

src/Plugin/KeyProvider/PrivateFileKeyProvider.php, line 105

Class

PrivateFileKeyProvider
Stores Apigee Edge authentication credentials in a private file.

Namespace

Drupal\apigee_edge\Plugin\KeyProvider

Code

public function realGetKeyValue(KeyInterface $key) {

  // If the key is new then the file does not exist in the filesystem yet
  // so do not try to read it.
  if ($key
    ->isNew()) {
    return NULL;
  }
  return file_get_contents($this
    ->getFileUri($key)) ?: NULL;
}