function LocalStream::dirname
Same name in other branches
- 9 core/lib/Drupal/Core/StreamWrapper/LocalStream.php \Drupal\Core\StreamWrapper\LocalStream::dirname()
- 10 core/lib/Drupal/Core/StreamWrapper/LocalStream.php \Drupal\Core\StreamWrapper\LocalStream::dirname()
- 11.x core/lib/Drupal/Core/StreamWrapper/LocalStream.php \Drupal\Core\StreamWrapper\LocalStream::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 PHP dirname() function because it does not support stream wrappers.
Parameters
string $uri: A URI or path.
Return value
string A string containing the directory name.
Overrides StreamWrapperInterface::dirname
See also
\Drupal\Core\File\FileSystemInterface::dirname()
File
-
core/
lib/ Drupal/ Core/ StreamWrapper/ LocalStream.php, line 412
Class
- LocalStream
- Defines a Drupal stream wrapper base class for local files.
Namespace
Drupal\Core\StreamWrapperCode
public function dirname($uri = NULL) {
list($scheme) = explode('://', $uri, 2);
$target = $this->getTarget($uri);
$dirname = dirname($target);
if ($dirname == '.') {
$dirname = '';
}
return $scheme . '://' . $dirname;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.