ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
LazyOpenStream.php
Go to the documentation of this file.
1<?php
2namespace GuzzleHttp\Psr7;
3
5
11{
12 use StreamDecoratorTrait;
13
15 private $filename;
16
18 private $mode;
19
24 public function __construct($filename, $mode)
25 {
26 $this->filename = $filename;
27 $this->mode = $mode;
28 }
29
35 protected function createStream()
36 {
37 return stream_for(try_fopen($this->filename, $this->mode));
38 }
39}
An exception for terminatinating execution or to throw for unit testing.
Lazily reads or writes to a file that is opened only after an IO operation take place on the stream.
createStream()
Creates the underlying stream lazily when required.
Describes a data stream.
stream_for($resource='', array $options=[])
Create a new stream based on the input type.
Definition: functions.php:78