You are here

public static function LegacyWrapper::getTarget in Mini site 8

Returns the part of a URI after the schema.

Parameters

string $uri: A stream, referenced as "scheme://target" or "data:target".

Return value

string|bool A string containing the target (path), or FALSE if none. For example, the URI "public://sample/test.txt" would return "sample/test.txt".

1 call to LegacyWrapper::getTarget()
minisite_requirements in ./minisite.install
Implements hook_requirements().

File

src/LegacyWrapper.php, line 109

Class

LegacyWrapper
Class LegacyWrapper.

Namespace

Drupal\minisite

Code

public static function getTarget($uri) {
  if (is_callable(StreamWrapperManager::class, 'getTarget')) {
    return StreamWrapperManager::getTarget($uri);
  }
  if (function_exists('file_uri_target')) {
    return file_uri_target($uri);
  }
  throw new \RuntimeException('Unable to find compatible function');
}