Interfaces
3 weeks ago
trait-bufferedwritestreamviaputcontents.php
3 weeks ago
trait-copydirectoryrecursive.php
3 weeks ago
trait-copyfileviastreaming.php
3 weeks ago
trait-copyrecursiveviastreaming.php
3 weeks ago
trait-getcontentsviareadstream.php
3 weeks ago
trait-internalizewritestream.php
3 weeks ago
trait-mkdirrecursive.php
3 weeks ago
trait-putcontentsviawritestream.php
3 weeks ago
trait-readonlyfilesystem.php
3 weeks ago
trait-renamefileviacopyandrm.php
3 weeks ago
trait-rmdirrecursive.php
3 weeks ago
trait-getcontentsviareadstream.php
18 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WordPress\Filesystem\Mixin; |
| 4 | |
| 5 | /** |
| 6 | * Implements get_contents() using the read stream provided by the open_read_stream() method. |
| 7 | */ |
| 8 | trait GetContentsViaReadStream { |
| 9 | |
| 10 | public function get_contents( $path ) { |
| 11 | $stream = $this->open_read_stream( $path ); |
| 12 | $body = $stream->consume_all(); |
| 13 | $stream->close_reading(); |
| 14 | |
| 15 | return $body; |
| 16 | } |
| 17 | } |
| 18 |