ServiceDependencyStreamWrapper.php

Same filename and directory in other branches
  1. main core/modules/system/tests/modules/stream_wrapper_service_test/src/StreamWrapper/ServiceDependencyStreamWrapper.php

Namespace

Drupal\stream_wrapper_service_test\StreamWrapper

File

core/modules/system/tests/modules/stream_wrapper_service_test/src/StreamWrapper/ServiceDependencyStreamWrapper.php

View source
<?php

declare (strict_types=1);
namespace Drupal\stream_wrapper_service_test\StreamWrapper;

use Drupal\Core\StreamWrapper\PublicStream;
use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface;

/**
 * A stream wrapper that depends on a service.
 */
class ServiceDependencyStreamWrapper extends PublicStream {
  
  /**
   * A service loaded from the global container in the constructor.
   */
  public StreamWrapperManagerInterface $streamWrapperManager;
  public function __construct() {
    $this->streamWrapperManager = \Drupal::service('stream_wrapper_service_test.dependency');
  }

}

Classes

Title Deprecated Summary
ServiceDependencyStreamWrapper A stream wrapper that depends on a service.

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