public function HttpStreamWrapper::dirname in Remote Stream Wrapper 8
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/
StreamWrapper/ HttpStreamWrapper.php, line 88
Class
- HttpStreamWrapper
- HTTP(s) stream wrapper.
Namespace
Drupal\remote_stream_wrapper\StreamWrapperCode
public function dirname($uri = NULL) {
if (!isset($uri)) {
$uri = $this->uri;
}
list($scheme, $target) = explode('://', $uri, 2);
$dirname = dirname($target);
if ($dirname == '.') {
$dirname = '';
}
return $scheme . '://' . $dirname;
}