You are here

private function SpecFetcher::checkRequirements in Apigee API Catalog 8

Same name and namespace in other branches
  1. 8.2 src/SpecFetcher.php \Drupal\apigee_api_catalog\SpecFetcher::checkRequirements()

Checks requirements for saving of a file spec.

If a requirement is not fulfilled it throws an exception.

Parameters

string $destination: The specification file destination directory, including scheme.

Throws

\Exception

1 call to SpecFetcher::checkRequirements()
SpecFetcher::fetchSpec in src/SpecFetcher.php
Fetch OpenAPI specification file from URL.

File

src/SpecFetcher.php, line 222

Class

SpecFetcher
Class SpecFetcher.

Namespace

Drupal\apigee_api_catalog

Code

private function checkRequirements(string $destination) : void {

  // If using private filesystem, check that it's been configured.
  if (strpos($destination, 'private://') === 0 && !$this
    ->isPrivateFileSystemConfigured()) {
    throw new \Exception('Private filesystem has not been configured.');
  }
  if (!file_prepare_directory($destination, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
    throw new \Exception('Could not prepare API Doc specification file destination directory.');
  }
}