You are here

public function SwaggerUiLibraryDiscovery::libraryDirectory in Swagger UI Field Formatter 8.3

Same name in this branch
  1. 8.3 src/Service/SwaggerUiLibraryDiscovery.php \Drupal\swagger_ui_formatter\Service\SwaggerUiLibraryDiscovery::libraryDirectory()
  2. 8.3 tests/modules/swagger_ui_formatter_test/src/Service/SwaggerUiLibraryDiscovery.php \Drupal\swagger_ui_formatter_test\Service\SwaggerUiLibraryDiscovery::libraryDirectory()

Gets the Swagger UI library directory.

This is a relative path from the DRUPAL_ROOT. No leading slash should be included in the returned path.

Return value

string The path of the Swagger UI library directory relative to DRUPAL_ROOT.

Throws

\Drupal\swagger_ui_formatter\Exception\SwaggerUiLibraryDiscoveryExceptionInterface

Overrides SwaggerUiLibraryDiscoveryInterface::libraryDirectory

File

tests/modules/swagger_ui_formatter_test/src/Service/SwaggerUiLibraryDiscovery.php, line 80

Class

SwaggerUiLibraryDiscovery
Decorator service for testing.

Namespace

Drupal\swagger_ui_formatter_test\Service

Code

public function libraryDirectory() : string {
  if ($this->state
    ->get(self::STATE_FAKE_MISSING_LIBRARY)) {
    throw SwaggerUiLibraryDiscoveryException::becauseLibraryDirectoryIsInvalid('fake-missing/swagger-ui');
  }
  return $this->decorated
    ->libraryDirectory();
}