| 1 | <?php |
||
| 13 | class LazyOpenStream implements StreamInterface |
||
| 14 | { |
||
| 15 | use StreamDecoratorTrait; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var string File to open |
||
| 19 | */ |
||
| 20 | private $filename; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var string $mode |
||
| 24 | */ |
||
| 25 | private $mode; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @param string $filename File to lazily open |
||
| 29 | * @param string $mode fopen mode to use when opening the stream |
||
| 30 | */ |
||
| 31 | 8 | public function __construct(string $filename, string $mode) |
|
| 36 | |||
| 37 | /** |
||
| 38 | * Creates the underlying stream lazily when required. |
||
| 39 | * |
||
| 40 | * @return StreamInterface |
||
| 41 | */ |
||
| 42 | 7 | protected function createStream() |
|
| 46 | } |
||
| 47 |