You are here

public function FileSystem::validScheme in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/File/FileSystem.php \Drupal\Core\File\FileSystem::validScheme()

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

4 calls to FileSystem::validScheme()
FileSystem::dirname in core/lib/Drupal/Core/File/FileSystem.php
Gets the name of the directory from a given path.
FileSystem::rmdir in core/lib/Drupal/Core/File/FileSystem.php
Removes a directory.
FileSystem::tempnam in core/lib/Drupal/Core/File/FileSystem.php
Creates a file with a unique filename in the specified directory.
FileSystem::unlink in core/lib/Drupal/Core/File/FileSystem.php
Deletes a file.

File

core/lib/Drupal/Core/File/FileSystem.php, line 300
Contains \Drupal\Core\File\FileSystem.

Class

FileSystem
Provides helpers to operate on files and stream wrappers.

Namespace

Drupal\Core\File

Code

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