[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

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

   1  <?php
   2  namespace GuzzleHttp\Stream;
   3  
   4  /**
   5   * Lazily reads or writes to a file that is opened only after an IO operation
   6   * take place on the stream.
   7   */
   8  class LazyOpenStream implements StreamInterface
   9  {
  10      use StreamDecoratorTrait;
  11  
  12      /** @var string File to open */
  13      private $filename;
  14  
  15      /** @var string $mode */
  16      private $mode;
  17  
  18      /**
  19       * @param string $filename File to lazily open
  20       * @param string $mode     fopen mode to use when opening the stream
  21       */
  22      public function __construct($filename, $mode)
  23      {
  24          $this->filename = $filename;
  25          $this->mode = $mode;
  26      }
  27  
  28      /**
  29       * Creates the underlying stream lazily when required.
  30       *
  31       * @return StreamInterface
  32       */
  33      protected function createStream()
  34      {
  35          return Stream::factory(Utils::open($this->filename, $this->mode));
  36      }
  37  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1