You are here

public function FlysystemBridge::dirname in Flysystem 8

Same name and namespace in other branches
  1. 7 src/FlysystemBridge.php \Drupal\flysystem\FlysystemBridge::dirname()
  2. 3.x src/FlysystemBridge.php \Drupal\flysystem\FlysystemBridge::dirname()
  3. 2.0.x src/FlysystemBridge.php \Drupal\flysystem\FlysystemBridge::dirname()
  4. 3.0.x src/FlysystemBridge.php \Drupal\flysystem\FlysystemBridge::dirname()

Gets the name of the directory from a given path.

This method is usually accessed through \Drupal\Core\File\FileSystemInterface::dirname(), which wraps around the normal PHP dirname() function, which does not support stream wrappers.

Parameters

string $uri: An optional URI.

Return value

string A string containing the directory name, or FALSE if not applicable.

Overrides StreamWrapperInterface::dirname

See also

\Drupal\Core\File\FileSystemInterface::dirname()

File

src/FlysystemBridge.php, line 80

Class

FlysystemBridge
An adapter for Flysystem to StreamWrapperInterface.

Namespace

Drupal\flysystem

Code

public function dirname($uri = NULL) {
  if (!isset($uri)) {
    $uri = $this->uri;
  }
  list($scheme, $target) = explode('://', $uri, 2);
  return $scheme . '://' . ltrim(Util::dirname($target), '\\/');
}