function ReadOnlyStream::getLocalPath

Same name in other branches
  1. 11.x core/lib/Drupal/Core/StreamWrapper/ReadOnlyStream.php \Drupal\Core\StreamWrapper\ReadOnlyStream::getLocalPath()

Returns the canonical absolute path of the URI, if possible.

@todo This method is called by ReadOnlyStream::stream_open on the abstract class, and therefore should be defined as well on the abstract class to prevent static analysis errors. In D11, consider changing it to an abstract method.

Parameters

string $uri: (optional) The stream wrapper URI to be converted to a canonical absolute path. This may point to a directory or another type of file.

Return value

string|bool If $uri is not set, returns the canonical absolute path of the URI previously set by the Drupal\Core\StreamWrapper\StreamWrapperInterface::setUri() function. If $uri is set and valid for this class, returns its canonical absolute path, as determined by the realpath() function. If $uri is set but not valid, returns FALSE.

Throws

\BadMethodCallException If the method is not implemented in the concrete driver class.

1 call to ReadOnlyStream::getLocalPath()
ReadOnlyStream::stream_open in core/lib/Drupal/Core/StreamWrapper/ReadOnlyStream.php
Support for fopen(), file_get_contents(), etc.

File

core/lib/Drupal/Core/StreamWrapper/ReadOnlyStream.php, line 118

Class

ReadOnlyStream
Defines a read-only Drupal stream wrapper base class.

Namespace

Drupal\Core\StreamWrapper

Code

protected function getLocalPath($uri = NULL) {
    throw new \BadMethodCallException(get_class($this) . '::getLocalPath() not implemented.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.