function StreamWrapperManager::getWrappers

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

File

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

Class

StreamWrapperManager
Provides a StreamWrapper manager.

Namespace

Drupal\Core\StreamWrapper

Code

public function getWrappers($filter = StreamWrapperInterface::ALL) {
  if (isset($this->wrappers[$filter])) {
    return $this->wrappers[$filter];
  }
  elseif (isset($this->wrappers[StreamWrapperInterface::ALL])) {
    $this->wrappers[$filter] = [];
    foreach ($this->wrappers[StreamWrapperInterface::ALL] as $scheme => $info) {
      // Bit-wise filter.
      if (($info['type'] & $filter) == $filter) {
        $this->wrappers[$filter][$scheme] = $info;
      }
    }
    return $this->wrappers[$filter];
  }
  else {
    return [];
  }
}

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