function SessionStreamWrapper::__construct
Same name in other branches
- 3.x modules/stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php \Drupal\stream_wrapper_example\StreamWrapper\SessionStreamWrapper::__construct()
- 8.x-1.x stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php \Drupal\stream_wrapper_example\StreamWrapper\SessionStreamWrapper::__construct()
Constructor method.
Note this cannot take any arguments; PHP's stream wrapper users do not know how to supply them.
@todo Refactor helper injection after https://www.drupal.org/node/3048126
File
-
modules/
stream_wrapper_example/ src/ StreamWrapper/ SessionStreamWrapper.php, line 153
Class
- SessionStreamWrapper
- Example stream wrapper class to handle session:// streams.
Namespace
Drupal\stream_wrapper_example\StreamWrapperCode
public function __construct() {
// Dependency injection will not work here, since PHP doesn't give us a
// chance to perform the injection. PHP creates the stream wrapper objects
// automatically when certain file functions are called. Therefore, we'll
// use the \Drupal service locator.
// phpcs:ignore
$this->sessionHelper = \Drupal::service('stream_wrapper_example.session_helper');
$this->sessionHelper
->setPath('.is_a_dir.txt', TRUE);
$this->streamMode = FALSE;
}