1 <?php
2
3 namespace Http\Message\Decorator;
4
5 use Psr\Http\Message\StreamInterface;
6
7 8 9 10 11
12 trait StreamDecorator
13 {
14 15 16
17 protected $stream;
18
19 20 21
22 public function __toString()
23 {
24 return $this->stream->__toString();
25 }
26
27 28 29
30 public function close()
31 {
32 $this->stream->close();
33 }
34
35 36 37
38 public function detach()
39 {
40 return $this->stream->detach();
41 }
42
43 44 45
46 public function getSize()
47 {
48 return $this->stream->getSize();
49 }
50
51 52 53
54 public function tell()
55 {
56 return $this->stream->tell();
57 }
58
59 60 61
62 public function eof()
63 {
64 return $this->stream->eof();
65 }
66
67 68 69
70 public function isSeekable()
71 {
72 return $this->stream->isSeekable();
73 }
74
75 76 77
78 public function seek($offset, $whence = SEEK_SET)
79 {
80 $this->stream->seek($offset, $whence);
81 }
82
83 84 85
86 public function rewind()
87 {
88 $this->stream->rewind();
89 }
90
91 92 93
94 public function isWritable()
95 {
96 return $this->stream->isWritable();
97 }
98
99 100 101
102 public function write($string)
103 {
104 return $this->stream->write($string);
105 }
106
107 108 109
110 public function isReadable()
111 {
112 return $this->stream->isReadable();
113 }
114
115 116 117
118 public function read($length)
119 {
120 return $this->stream->read($length);
121 }
122
123 124 125
126 public function getContents()
127 {
128 return $this->stream->getContents();
129 }
130
131 132 133
134 public function getMetadata($key = null)
135 {
136 return $this->stream->getMetadata($key);
137 }
138 }
139