PluginProbe
Media Cloud Sync / 1.0.1
Media Cloud Sync v1.0.1
1.4.2 1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 All 36 releases
media-cloud-sync / includes / sdk / s3 / GuzzleHttp / Psr7 / LazyOpenStream.php

LazyOpenStream.php in Media Cloud Sync 1.0.1, at includes/sdk/s3/GuzzleHttp/Psr7/LazyOpenStream.php

38 lines 933 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Dudlewebs\WPMCS\s3\GuzzleHttp\Psr7;
4
5 use Dudlewebs\WPMCS\s3\Psr\Http\Message\StreamInterface;
6 /**
7 * Lazily reads or writes to a file that is opened only after an IO operation
8 * take place on the stream.
9 *
10 * @final
11 */
12 class LazyOpenStream implements StreamInterface
13 {
14 use StreamDecoratorTrait;
15 /** @var string File to open */
16 private $filename;
17 /** @var string */
18 private $mode;
19 /**
20 * @param string $filename File to lazily open
21 * @param string $mode fopen mode to use when opening the stream
22 */
23 public function __construct($filename, $mode)
24 {
25 $this->filename = $filename;
26 $this->mode = $mode;
27 }
28 /**
29 * Creates the underlying stream lazily when required.
30 *
31 * @return StreamInterface
32 */
33 protected function createStream()
34 {
35 return Utils::streamFor(Utils::tryFopen($this->filename, $this->mode));
36 }
37 }
38