You are here

public function OauthTokenFileStorage::removeTokenFile in Apigee Edge 8

Removes the file in which the OAuth token data is stored.

File

src/OauthTokenFileStorage.php, line 222

Class

OauthTokenFileStorage
Stores OAuth token data in a file.

Namespace

Drupal\apigee_edge

Code

public function removeTokenFile() : void {
  if ($this
    ->isTokenFileInPrivateFileSystem() && !$this
    ->isPrivateFileSystemConfigured() || !file_exists($this->tokenFilePath)) {

    // Do not try to delete the file if private filesystem has not been
    // configured because in that cause "private://" scheme is not
    // registered. Also do nothing if token file does not exist.
    return;
  }
  try {
    $this->fileSystem
      ->delete($this->tokenFilePath);
  } catch (FileException $e) {

    // Do nothing.
  }
}