| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
namespace AWS\CRT\HTTP; |
| 7 |
|
| 8 |
use AWS\CRT\IO\InputStream; |
| 9 |
|
| 10 |
class Request extends Message { |
| 11 |
private $body_stream = null; |
| 12 |
|
| 13 |
public function __construct($method, $path, $query = [], $headers = [], $body_stream = null) { |
| 14 |
parent::__construct($method, $path, $query, $headers); |
| 15 |
if (!is_null($body_stream) && !($body_stream instanceof InputStream)) { |
| 16 |
throw new \InvalidArgumentException('body_stream must be an instance of ' . InputStream::class); |
| 17 |
} |
| 18 |
$this->body_stream = $body_stream; |
| 19 |
} |
| 20 |
|
| 21 |
public static function marshall($request) { |
| 22 |
return parent::marshall($request); |
| 23 |
} |
| 24 |
|
| 25 |
public static function unmarshall($buf) { |
| 26 |
return parent::_unmarshall($buf, Request::class); |
| 27 |
} |
| 28 |
|
| 29 |
public function body_stream() { |
| 30 |
return $this->body_stream; |
| 31 |
} |
| 32 |
} |