[ Index ]

PHP Cross Reference of phpBB-3.3.3-deutsch

title

Body

[close]

/vendor/guzzlehttp/psr7/src/ -> LazyOpenStream.php (source)

   1  <?php
   2  
   3  namespace GuzzleHttp\Psr7;
   4  
   5  use Psr\Http\Message\StreamInterface;
   6  
   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  class LazyOpenStream implements StreamInterface
  12  {
  13      use StreamDecoratorTrait;
  14  
  15      /** @var string File to open */
  16      private $filename;
  17  
  18      /** @var string $mode */
  19      private $mode;
  20  
  21      /**
  22       * @param string $filename File to lazily open
  23       * @param string $mode     fopen mode to use when opening the stream
  24       */
  25      public function __construct($filename, $mode)
  26      {
  27          $this->filename = $filename;
  28          $this->mode = $mode;
  29      }
  30  
  31      /**
  32       * Creates the underlying stream lazily when required.
  33       *
  34       * @return StreamInterface
  35       */
  36      protected function createStream()
  37      {
  38          return Utils::streamFor(Utils::tryFopen($this->filename, $this->mode));
  39      }
  40  }


Generated: Sun Feb 14 20:08:31 2021 Cross-referenced by PHPXref 0.7.1