PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.5
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.5
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / vendor_prefixed / guzzlehttp / psr7 / src / LazyOpenStream.php

LazyOpenStream.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.5, at vendor_prefixed/guzzlehttp/psr7/src/LazyOpenStream.php

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