| Total Complexity | 6 |
| Total Lines | 80 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 13 | class Request extends Message |
||
| 14 | {
|
||
| 15 | /** HTTP request method */ |
||
| 16 | const |
||
| 17 | DELETE = 'DELETE', |
||
| 18 | GET = 'GET', |
||
| 19 | HEAD = 'HEAD', |
||
| 20 | PATCH = 'PATCH', |
||
| 21 | POST = 'POST', |
||
| 22 | PUT = 'PUT'; |
||
| 23 | |||
| 24 | |||
| 25 | /** @var string */ |
||
| 26 | private $method; |
||
| 27 | |||
| 28 | /** @var string */ |
||
| 29 | private $url; |
||
| 30 | |||
| 31 | |||
| 32 | /** |
||
| 33 | * @param string |
||
| 34 | * @param string |
||
| 35 | * @param array |
||
| 36 | * @param string|NULL |
||
| 37 | */ |
||
| 38 | public function __construct($method, $url, array $headers = [], $content = NULL) |
||
| 39 | {
|
||
| 40 | $this->method = $method; |
||
| 41 | $this->url = $url; |
||
| 42 | parent::__construct($headers, $content); |
||
| 43 | } |
||
| 44 | |||
| 45 | |||
| 46 | /** |
||
| 47 | * @param string |
||
| 48 | * @return bool |
||
| 49 | */ |
||
| 50 | public function isMethod($method) |
||
| 51 | {
|
||
| 52 | return strcasecmp($this->method, $method) === 0; |
||
| 53 | } |
||
| 54 | |||
| 55 | |||
| 56 | /** |
||
| 57 | * @return string |
||
| 58 | */ |
||
| 59 | public function getMethod() |
||
| 60 | {
|
||
| 61 | return $this->method; |
||
| 62 | } |
||
| 63 | |||
| 64 | |||
| 65 | /** |
||
| 66 | * @return string |
||
| 67 | */ |
||
| 68 | public function getUrl() |
||
| 69 | {
|
||
| 70 | return $this->url; |
||
| 71 | } |
||
| 72 | |||
| 73 | |||
| 74 | /** |
||
| 75 | * @param string |
||
| 76 | * @param string |
||
| 77 | * @return self |
||
| 78 | */ |
||
| 79 | public function addHeader($name, $value) |
||
| 82 | } |
||
| 83 | |||
| 84 | |||
| 85 | /** |
||
| 86 | * @param string |
||
| 87 | * @param string|NULL |
||
| 88 | * @return self |
||
| 89 | */ |
||
| 90 | public function setHeader($name, $value) |
||
| 93 | } |
||
| 94 | |||
| 95 | } |
||
| 96 |