StreamWrapperManager::registerWrapper

public StreamWrapperManager::registerWrapper($scheme, $class, $type)

Registers stream wrapper with PHP.

Parameters

string $scheme: The scheme of the stream wrapper.

string $class: The class of the stream wrapper.

int $type: The type of the stream wrapper.

Overrides StreamWrapperManagerInterface::registerWrapper

File

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

Class

StreamWrapperManager
Provides a StreamWrapper manager.

Namespace

Drupal\Core\StreamWrapper

Code

public function registerWrapper($scheme, $class, $type) {
  if (in_array($scheme, stream_get_wrappers(), TRUE)) {
    stream_wrapper_unregister($scheme);
  }

  if (($type & StreamWrapperInterface::LOCAL) == StreamWrapperInterface::LOCAL) {
    stream_wrapper_register($scheme, $class);
  }
  else {
    stream_wrapper_register($scheme, $class, STREAM_IS_URL);
  }

  // Pre-populate the static cache with the filters most typically used.
  $info = array('type' => $type, 'class' => $class);
  $this->wrappers[StreamWrapperInterface::ALL][$scheme] = $info;

  if (($type & StreamWrapperInterface::WRITE_VISIBLE) == StreamWrapperInterface::WRITE_VISIBLE) {
    $this->wrappers[StreamWrapperInterface::WRITE_VISIBLE][$scheme] = $info;
  }
}
doc_Drupal
2016-10-29 09:44:56
Comments
Leave a Comment

Please login to continue.