You are here

public function StreamWrapperManager::getViaUri in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php \Drupal\Core\StreamWrapper\StreamWrapperManager::getViaUri()

Returns a reference to the stream wrapper class responsible for a URI.

The scheme determines the stream wrapper class that should be used by consulting the stream wrapper registry.

Parameters

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

Return value

\Drupal\Core\StreamWrapper\StreamWrapperInterface|bool Returns a new stream wrapper object appropriate for the given URI or FALSE if no registered handler could be found. For example, a URI of "private://example.txt" would return a new private stream wrapper object (Drupal\Core\StreamWrapper\PrivateStream).

Overrides StreamWrapperManagerInterface::getViaUri

File

core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php, line 104
Contains \Drupal\Core\StreamWrapper\StreamWrapperManager.

Class

StreamWrapperManager
Provides a StreamWrapper manager.

Namespace

Drupal\Core\StreamWrapper

Code

public function getViaUri($uri) {
  $scheme = file_uri_scheme($uri);
  return $this
    ->getWrapper($scheme, $uri);
}