You are here

class DummyExternalReadOnlyWrapper in Drupal 10

Helper class for testing the stream wrapper registry.

Dummy external stream wrapper implementation (dummy-external-readonly://).

Hierarchy

Expanded class hierarchy of DummyExternalReadOnlyWrapper

1 string reference to 'DummyExternalReadOnlyWrapper'
file_test.services.yml in core/modules/file/tests/file_test/file_test.services.yml
core/modules/file/tests/file_test/file_test.services.yml
1 service uses DummyExternalReadOnlyWrapper
stream_wrapper.dummy_external_readonly in core/modules/file/tests/file_test/file_test.services.yml
Drupal\file_test\StreamWrapper\DummyExternalReadOnlyWrapper

File

core/modules/file/tests/file_test/src/StreamWrapper/DummyExternalReadOnlyWrapper.php, line 13

Namespace

Drupal\file_test\StreamWrapper
View source
class DummyExternalReadOnlyWrapper extends ReadOnlyStream {

  /**
   * @inheritDoc
   */
  public static function getType() {
    return StreamWrapperInterface::READ_VISIBLE;
  }

  /**
   * @inheritDoc
   */
  public function getName() {
    return t('Dummy external stream wrapper (readonly)');
  }

  /**
   * @inheritDoc
   */
  public function getDescription() {
    return t('Dummy external read-only stream wrapper for testing.');
  }

  /**
   * @inheritDoc
   */
  public function getExternalUrl() {
    [
      ,
      $target,
    ] = explode('://', $this->uri, 2);
    return 'https://www.dummy-external-readonly.com/' . $target;
  }

  /**
   * @inheritDoc
   */
  public function realpath() {
    return FALSE;
  }

  /**
   * @inheritDoc
   */
  public function dirname($uri = NULL) {
    return FALSE;
  }

  /**
   * @inheritDoc
   */
  public function dir_closedir() {
    return FALSE;
  }

  /**
   * @inheritDoc
   */
  public function dir_opendir($path, $options) {
    return FALSE;
  }

  /**
   * @inheritDoc
   */
  public function dir_readdir() {
    return FALSE;
  }

  /**
   * @inheritDoc
   */
  public function dir_rewinddir() {
    return FALSE;
  }

  /**
   * @inheritDoc
   */
  public function stream_cast($cast_as) {
    return FALSE;
  }

  /**
   * @inheritDoc
   */
  public function stream_close() {
    return FALSE;
  }

  /**
   * @inheritDoc
   */
  public function stream_eof() {
    return FALSE;
  }

  /**
   * @inheritDoc
   */
  public function stream_read($count) {
    return FALSE;
  }

  /**
   * @inheritDoc
   */
  public function stream_seek($offset, $whence = SEEK_SET) {
    return FALSE;
  }

  /**
   * @inheritDoc
   */
  public function stream_set_option($option, $arg1, $arg2) {
    return FALSE;
  }

  /**
   * @inheritDoc
   */
  public function stream_stat() {
    return FALSE;
  }

  /**
   * @inheritDoc
   */
  public function stream_tell() {
    return FALSE;
  }

  /**
   * @inheritDoc
   */
  public function url_stat($path, $flags) {
    return FALSE;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DummyExternalReadOnlyWrapper::dirname public function @inheritDoc Overrides StreamWrapperInterface::dirname
DummyExternalReadOnlyWrapper::dir_closedir public function @inheritDoc Overrides PhpStreamWrapperInterface::dir_closedir
DummyExternalReadOnlyWrapper::dir_opendir public function @inheritDoc Overrides PhpStreamWrapperInterface::dir_opendir
DummyExternalReadOnlyWrapper::dir_readdir public function @inheritDoc Overrides PhpStreamWrapperInterface::dir_readdir
DummyExternalReadOnlyWrapper::dir_rewinddir public function @inheritDoc Overrides PhpStreamWrapperInterface::dir_rewinddir
DummyExternalReadOnlyWrapper::getDescription public function @inheritDoc Overrides StreamWrapperInterface::getDescription
DummyExternalReadOnlyWrapper::getExternalUrl public function @inheritDoc Overrides StreamWrapperInterface::getExternalUrl
DummyExternalReadOnlyWrapper::getName public function @inheritDoc Overrides StreamWrapperInterface::getName
DummyExternalReadOnlyWrapper::getType public static function @inheritDoc Overrides StreamWrapperInterface::getType
DummyExternalReadOnlyWrapper::realpath public function @inheritDoc Overrides StreamWrapperInterface::realpath
DummyExternalReadOnlyWrapper::stream_cast public function @inheritDoc Overrides PhpStreamWrapperInterface::stream_cast
DummyExternalReadOnlyWrapper::stream_close public function @inheritDoc Overrides PhpStreamWrapperInterface::stream_close
DummyExternalReadOnlyWrapper::stream_eof public function @inheritDoc Overrides PhpStreamWrapperInterface::stream_eof
DummyExternalReadOnlyWrapper::stream_read public function @inheritDoc Overrides PhpStreamWrapperInterface::stream_read
DummyExternalReadOnlyWrapper::stream_seek public function @inheritDoc Overrides PhpStreamWrapperInterface::stream_seek
DummyExternalReadOnlyWrapper::stream_set_option public function @inheritDoc Overrides PhpStreamWrapperInterface::stream_set_option
DummyExternalReadOnlyWrapper::stream_stat public function @inheritDoc Overrides PhpStreamWrapperInterface::stream_stat
DummyExternalReadOnlyWrapper::stream_tell public function @inheritDoc Overrides PhpStreamWrapperInterface::stream_tell
DummyExternalReadOnlyWrapper::url_stat public function @inheritDoc Overrides PhpStreamWrapperInterface::url_stat
ReadOnlyStream::$context public property Stream context resource.
ReadOnlyStream::$handle public property A generic resource handle.
ReadOnlyStream::$uri protected property Instance URI (stream).
ReadOnlyStream::getUri public function
ReadOnlyStream::mkdir public function Support for mkdir().
ReadOnlyStream::rename public function Support for rename().
ReadOnlyStream::rmdir public function Support for rmdir().
ReadOnlyStream::setUri public function
ReadOnlyStream::stream_flush public function Support for fflush().
ReadOnlyStream::stream_lock public function Support for flock().
ReadOnlyStream::stream_metadata public function Does not change meta data as this is a read-only stream wrapper.
ReadOnlyStream::stream_open public function Support for fopen(), file_get_contents(), etc.
ReadOnlyStream::stream_truncate public function
ReadOnlyStream::stream_write public function Support for fwrite(), file_put_contents() etc.
ReadOnlyStream::unlink public function Support for unlink().
StreamWrapperInterface::ALL constant A filter that matches all wrappers.
StreamWrapperInterface::HIDDEN constant Defines the stream wrapper bit flag for a hidden file.
StreamWrapperInterface::LOCAL constant Refers to a local file system location.
StreamWrapperInterface::LOCAL_HIDDEN constant Hidden, readable and writable using local files.
StreamWrapperInterface::LOCAL_NORMAL constant Visible, readable and writable using local files.
StreamWrapperInterface::NORMAL constant This is the default 'type' flag. This does not include StreamWrapperInterface::LOCAL, because PHP grants a greater trust level to local files (for example, they can be used in an "include" statement, regardless of the…
StreamWrapperInterface::READ constant Wrapper is readable (almost always true).
StreamWrapperInterface::READ_VISIBLE constant Visible and read-only.
StreamWrapperInterface::VISIBLE constant Exposed in the UI and potentially web accessible.
StreamWrapperInterface::WRITE constant Wrapper is writable.
StreamWrapperInterface::WRITE_VISIBLE constant Visible, readable and writable.