public function ExtensionStreamBase::dirname in System stream wrapper 8
Gets the name of the directory from a given path.
This method is usually accessed through drupal_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 LocalStreamTrait::dirname
See also
File
- src/
StreamWrapper/ ExtensionStreamBase.php, line 76
Class
- ExtensionStreamBase
- Defines a base stream wrapper implementation.
Namespace
Drupal\system_stream_wrapper\StreamWrapperCode
public function dirname($uri = NULL) {
if (!isset($uri)) {
$uri = $this->uri;
}
else {
$this->uri = $uri;
}
if (isset($uri)) {
$this->uri = $uri;
}
list($scheme) = explode('://', $uri, 2);
$dirname = dirname($this
->getTarget($uri));
$dirname = $dirname !== '.' ? rtrim("/{$dirname}", '/') : '';
return "{$scheme}://{$this->getOwnerName()}{$dirname}";
}