function StreamWrapperManager::isValidScheme

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

Checks that the scheme of a stream URI is valid.

Confirms that there is a registered stream handler for the provided scheme and that it is callable. This is useful if you want to confirm a valid scheme without creating a new instance of the registered handler.

Parameters

string $scheme: A URI scheme, a stream is referenced as "scheme://target".

Return value

bool Returns TRUE if the string is the name of a validated stream, or FALSE if the scheme does not have a registered handler.

Overrides StreamWrapperManagerInterface::isValidScheme

2 calls to StreamWrapperManager::isValidScheme()
StreamWrapperManager::isValidUri in core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php
Determines whether the URI has a valid scheme for file API operations.
StreamWrapperManager::normalizeUri in core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php
Normalizes a URI by making it syntactically correct.

File

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

Class

StreamWrapperManager
Provides a StreamWrapper manager.

Namespace

Drupal\Core\StreamWrapper

Code

public function isValidScheme($scheme) {
    if (!$scheme) {
        return FALSE;
    }
    return class_exists($this->getClass($scheme));
}

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