function StreamWrapperManager::unregister

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

Unregisters the tagged stream wrappers.

Internal use only.

File

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

Class

StreamWrapperManager
Provides a StreamWrapper manager.

Namespace

Drupal\Core\StreamWrapper

Code

public function unregister() {
  // Normally, there are definitely wrappers set for the ALL filter. However,
  // in some cases involving many container rebuilds (e.g. BrowserTestBase),
  // $this->wrappers may be empty although wrappers are still registered
  // globally. Thus an isset() check is needed before iterating.
  if (isset($this->wrappers[StreamWrapperInterface::ALL])) {
    foreach (array_keys($this->wrappers[StreamWrapperInterface::ALL]) as $scheme) {
      stream_wrapper_unregister($scheme);
    }
  }
}

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