You are here

public function FileSystem::validScheme in Drupal 8

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 FileSystemInterface::validScheme

Deprecated

in drupal:8.0.0 and is removed from drupal:9.0.0. Use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface::isValidScheme() instead.

See also

https://www.drupal.org/node/3035273

File

core/lib/Drupal/Core/File/FileSystem.php, line 302

Class

FileSystem
Provides helpers to operate on files and stream wrappers.

Namespace

Drupal\Core\File

Code

public function validScheme($scheme) {
  @trigger_error('FileSystem::validScheme() is deprecated in drupal:8.8.0 and will be removed before drupal:9.0.0. Use \\Drupal\\Core\\StreamWrapper\\StreamWrapperManagerInterface::isValidScheme() instead. See https://www.drupal.org/node/3035273', E_USER_DEPRECATED);
  return $this->streamWrapperManager
    ->isValidScheme($scheme);
}