GuzzleHttpPsr7LazyOpenStream

Lazily reads or writes to a file that is opened only after an IO operation take place on the stream.

Defined (1)

The class is defined in the following location(s).

/lib/Azure/GuzzleHttp/Psr7/LazyOpenStream.php  
  1. class LazyOpenStream implements StreamInterface 
  2. use StreamDecoratorTrait; 
  3.  
  4. /** @var string File to open */ 
  5. private $filename; 
  6.  
  7. /** @var string $mode */ 
  8. private $mode; 
  9.  
  10. /** 
  11. * @param string $filename File to lazily open 
  12. * @param string $mode fopen mode to use when opening the stream 
  13. */ 
  14. public function __construct($filename, $mode) 
  15. $this->filename = $filename; 
  16. $this->mode = $mode; 
  17.  
  18. /** 
  19. * Creates the underlying stream lazily when required. 
  20. * @return StreamInterface 
  21. */ 
  22. protected function createStream() 
  23. return stream_for(try_fopen($this->filename, $this->mode));