1: <?php
2:
3: namespace Guzzle\Http;
4:
5: use Guzzle\Stream\Stream;
6:
7: 8: 9:
10: class AbstractEntityBodyDecorator implements EntityBodyInterface
11: {
12: 13: 14:
15: protected $body;
16:
17: 18: 19: 20: 21:
22: public function __construct(EntityBodyInterface $body)
23: {
24: $this->body = $body;
25: }
26:
27: 28: 29:
30: public function __toString()
31: {
32: return (string) $this->body;
33: }
34:
35: 36: 37: 38: 39: 40: 41: 42:
43: public function __call($method, array $args = null)
44: {
45: return call_user_func_array(array($this->body, $method), $args);
46: }
47:
48: 49: 50:
51: public function close()
52: {
53: return $this->body->close();
54: }
55:
56: 57: 58:
59: public function setRewindFunction($callable)
60: {
61: $this->body->setRewindFunction($callable);
62:
63: return $this;
64: }
65:
66: 67: 68:
69: public function rewind()
70: {
71: return $this->body->rewind();
72: }
73:
74: 75: 76:
77: public function compress($filter = 'zlib.deflate')
78: {
79: return $this->body->compress($filter);
80: }
81:
82: 83: 84:
85: public function uncompress($filter = 'zlib.inflate')
86: {
87: return $this->body->uncompress($filter);
88: }
89:
90: 91: 92:
93: public function getContentLength()
94: {
95: return $this->getSize();
96: }
97:
98: 99: 100:
101: public function getContentType()
102: {
103: return $this->body->getContentType();
104: }
105:
106: 107: 108:
109: public function getContentMd5($rawOutput = false, $base64Encode = false)
110: {
111: $hash = Stream::getHash($this, 'md5', $rawOutput);
112:
113: return $hash && $base64Encode ? base64_encode($hash) : $hash;
114: }
115:
116: 117: 118:
119: public function getContentEncoding()
120: {
121: return $this->body->getContentEncoding();
122: }
123:
124: 125: 126:
127: public function getMetaData($key = null)
128: {
129: return $this->body->getMetaData($key);
130: }
131:
132: 133: 134:
135: public function getStream()
136: {
137: return $this->body->getStream();
138: }
139:
140: 141: 142:
143: public function setStream($stream, $size = 0)
144: {
145: $this->body->setStream($stream, $size);
146:
147: return $this;
148: }
149:
150: 151: 152:
153: public function getWrapper()
154: {
155: return $this->body->getWrapper();
156: }
157:
158: 159: 160:
161: public function getWrapperData()
162: {
163: return $this->body->getWrapperData();
164: }
165:
166: 167: 168:
169: public function getStreamType()
170: {
171: return $this->body->getStreamType();
172: }
173:
174: 175: 176:
177: public function getUri()
178: {
179: return $this->body->getUri();
180: }
181:
182: 183: 184:
185: public function getSize()
186: {
187: return $this->body->getSize();
188: }
189:
190: 191: 192:
193: public function isReadable()
194: {
195: return $this->body->isReadable();
196: }
197:
198: 199: 200:
201: public function isWritable()
202: {
203: return $this->body->isWritable();
204: }
205:
206: 207: 208:
209: public function isConsumed()
210: {
211: return $this->body->isConsumed();
212: }
213:
214: 215: 216: 217:
218: public function feof()
219: {
220: return $this->isConsumed();
221: }
222:
223: 224: 225:
226: public function isLocal()
227: {
228: return $this->body->isLocal();
229: }
230:
231: 232: 233:
234: public function isSeekable()
235: {
236: return $this->body->isSeekable();
237: }
238:
239: 240: 241:
242: public function setSize($size)
243: {
244: $this->body->setSize($size);
245:
246: return $this;
247: }
248:
249: 250: 251:
252: public function seek($offset, $whence = SEEK_SET)
253: {
254: return $this->body->seek($offset, $whence);
255: }
256:
257: 258: 259:
260: public function read($length)
261: {
262: return $this->body->read($length);
263: }
264:
265: 266: 267:
268: public function write($string)
269: {
270: return $this->body->write($string);
271: }
272:
273: 274: 275:
276: public function readLine($maxLength = null)
277: {
278: return $this->body->readLine($maxLength);
279: }
280:
281: 282: 283:
284: public function ftell()
285: {
286: return $this->body->ftell();
287: }
288:
289: 290: 291:
292: public function getCustomData($key)
293: {
294: return $this->body->getCustomData($key);
295: }
296:
297: 298: 299:
300: public function setCustomData($key, $value)
301: {
302: $this->body->setCustomData($key, $value);
303:
304: return $this;
305: }
306: }
307: