You are here

public function VideoRemoteStreamWrapper::dirname in Video 8

Same name and namespace in other branches
  1. 8.2 src/StreamWrapper/VideoRemoteStreamWrapper.php \Drupal\video\StreamWrapper\VideoRemoteStreamWrapper::dirname()

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 StreamWrapperInterface::dirname

See also

drupal_dirname()

File

src/StreamWrapper/VideoRemoteStreamWrapper.php, line 155

Class

VideoRemoteStreamWrapper
Defines a video read only stream wrapper class.

Namespace

Drupal\video\StreamWrapper

Code

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