You are here

public static function LegacyWrapper::isValidUri in Mini site 8

Determines whether the URI has a valid scheme for file API operations.

Throws

\RuntimeException If compatible function is not found.

3 calls to LegacyWrapper::isValidUri()
Asset::loadByUri in src/Asset.php
Load asset by URI location.
template_preprocess_minisite_link in ./minisite.theme.inc
Prepares variables for minisite link templates.
UrlValidator::relativeToRoot in src/UrlValidator.php
Convert relative to root-level URL with parent prefix support.

File

src/LegacyWrapper.php, line 46

Class

LegacyWrapper
Class LegacyWrapper.

Namespace

Drupal\minisite

Code

public static function isValidUri($uri) {
  if (method_exists(StreamWrapperManager::class, 'isValidUri')) {
    return \Drupal::service('stream_wrapper_manager')
      ->isValidUri($uri);
  }
  if (function_exists('file_valid_uri')) {
    return file_valid_uri($uri);
  }
  throw new \RuntimeException('Unable to find compatible function');
}