close
Warning:
AdminModule failed with TracError: Unable to instantiate component <class 'trac.ticket.admin.TicketTypeAdminPanel'> (super(type, obj): obj (type TicketTypeAdminPanel) is not an instance or subtype of type (Markup).)
|
Last change
on this file since 4b09d68 was 01a620f, checked in by Joachim Langenbach <joachim.langenbach@…>, 11 years ago |
|
Removed submodules for php externals and use composer to provide them and versioned them afterwards
|
-
Property mode
set to
100644
|
|
File size:
880 bytes
|
| Rev | Line | |
|---|
| [01a620f] | 1 | <?php
|
|---|
| 2 | namespace GuzzleHttp\Psr7;
|
|---|
| 3 |
|
|---|
| 4 | use Psr\Http\Message\StreamInterface;
|
|---|
| 5 |
|
|---|
| 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 | class LazyOpenStream implements StreamInterface
|
|---|
| 11 | {
|
|---|
| 12 | use StreamDecoratorTrait;
|
|---|
| 13 |
|
|---|
| 14 | /** @var string File to open */
|
|---|
| 15 | private $filename;
|
|---|
| 16 |
|
|---|
| 17 | /** @var string $mode */
|
|---|
| 18 | private $mode;
|
|---|
| 19 |
|
|---|
| 20 | /**
|
|---|
| 21 | * @param string $filename File to lazily open
|
|---|
| 22 | * @param string $mode fopen mode to use when opening the stream
|
|---|
| 23 | */
|
|---|
| 24 | public function __construct($filename, $mode)
|
|---|
| 25 | {
|
|---|
| 26 | $this->filename = $filename;
|
|---|
| 27 | $this->mode = $mode;
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
| 30 | /**
|
|---|
| 31 | * Creates the underlying stream lazily when required.
|
|---|
| 32 | *
|
|---|
| 33 | * @return StreamInterface
|
|---|
| 34 | */
|
|---|
| 35 | protected function createStream()
|
|---|
| 36 | {
|
|---|
| 37 | return stream_for(try_fopen($this->filename, $this->mode));
|
|---|
| 38 | }
|
|---|
| 39 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.
Download in other formats: