function StreamWrapperManager::getWrapper

Same name in other branches
  1. 9 core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php \Drupal\Core\StreamWrapper\StreamWrapperManager::getWrapper()
  2. 8.9.x core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php \Drupal\Core\StreamWrapper\StreamWrapperManager::getWrapper()
  3. 10 core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php \Drupal\Core\StreamWrapper\StreamWrapperManager::getWrapper()

Returns a stream wrapper instance.

Parameters

string $scheme: The scheme of the desired stream wrapper.

string $uri: The URI of the stream.

Return value

\Drupal\Core\StreamWrapper\StreamWrapperInterface|bool A stream wrapper object, or false if the scheme is not available.

2 calls to StreamWrapperManager::getWrapper()
StreamWrapperManager::getViaScheme in core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php
Returns a reference to the stream wrapper class responsible for a scheme.
StreamWrapperManager::getViaUri in core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php
Returns a reference to the stream wrapper class responsible for a URI.

File

core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php, line 137

Class

StreamWrapperManager
Provides a StreamWrapper manager.

Namespace

Drupal\Core\StreamWrapper

Code

protected function getWrapper($scheme, $uri) {
    if (isset($this->info[$scheme]['service_id'])) {
        $instance = $this->container
            ->get($this->info[$scheme]['service_id']);
        $instance->setUri($uri);
        return $instance;
    }
    return FALSE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.