| @@ 11-95 (lines=85) @@ | ||
| 8 | ||
| 9 | namespace BFunky\HttpParser\Entity; |
|
| 10 | ||
| 11 | class HttpRequestHeader implements HttpHeaderInterface |
|
| 12 | { |
|
| 13 | /** |
|
| 14 | * @var string |
|
| 15 | */ |
|
| 16 | protected $method; |
|
| 17 | ||
| 18 | /** |
|
| 19 | * @var string |
|
| 20 | */ |
|
| 21 | protected $path; |
|
| 22 | ||
| 23 | /** |
|
| 24 | * @var string |
|
| 25 | */ |
|
| 26 | protected $protocol; |
|
| 27 | ||
| 28 | /** |
|
| 29 | * HttpRequestHeader constructor. |
|
| 30 | * @param string $method |
|
| 31 | * @param string $path |
|
| 32 | * @param string $protocol |
|
| 33 | */ |
|
| 34 | public function __construct(string $method, string $path, string $protocol) |
|
| 35 | { |
|
| 36 | $this->method = $method; |
|
| 37 | $this->path = $path; |
|
| 38 | $this->protocol = $protocol; |
|
| 39 | } |
|
| 40 | ||
| 41 | ||
| 42 | /** |
|
| 43 | * @return string |
|
| 44 | */ |
|
| 45 | public function getMethod(): string |
|
| 46 | { |
|
| 47 | return $this->method; |
|
| 48 | } |
|
| 49 | ||
| 50 | /** |
|
| 51 | * @param string $method |
|
| 52 | * @return HttpRequestHeader |
|
| 53 | */ |
|
| 54 | public function setMethod(string $method): HttpRequestHeader |
|
| 55 | { |
|
| 56 | $this->method = $method; |
|
| 57 | return $this; |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * @return string |
|
| 62 | */ |
|
| 63 | public function getPath(): string |
|
| 64 | { |
|
| 65 | return $this->path; |
|
| 66 | } |
|
| 67 | ||
| 68 | /** |
|
| 69 | * @param string $path |
|
| 70 | * @return HttpRequestHeader |
|
| 71 | */ |
|
| 72 | public function setPath(string $path): HttpRequestHeader |
|
| 73 | { |
|
| 74 | $this->path = $path; |
|
| 75 | return $this; |
|
| 76 | } |
|
| 77 | ||
| 78 | /** |
|
| 79 | * @return string |
|
| 80 | */ |
|
| 81 | public function getProtocol(): string |
|
| 82 | { |
|
| 83 | return $this->protocol; |
|
| 84 | } |
|
| 85 | ||
| 86 | /** |
|
| 87 | * @param string $protocol |
|
| 88 | * @return HttpRequestHeader |
|
| 89 | */ |
|
| 90 | public function setProtocol(string $protocol): HttpRequestHeader |
|
| 91 | { |
|
| 92 | $this->protocol = $protocol; |
|
| 93 | return $this; |
|
| 94 | } |
|
| 95 | } |
|
| @@ 11-94 (lines=84) @@ | ||
| 8 | ||
| 9 | namespace BFunky\HttpParser\Entity; |
|
| 10 | ||
| 11 | class HttpResponseHeader implements HttpHeaderInterface |
|
| 12 | { |
|
| 13 | /** |
|
| 14 | * @var string |
|
| 15 | */ |
|
| 16 | protected $protocol; |
|
| 17 | ||
| 18 | /** |
|
| 19 | * @var string |
|
| 20 | */ |
|
| 21 | protected $code; |
|
| 22 | ||
| 23 | /** |
|
| 24 | * @var string |
|
| 25 | */ |
|
| 26 | protected $message; |
|
| 27 | ||
| 28 | /** |
|
| 29 | * HttpResponseHeader constructor. |
|
| 30 | * @param string $protocol |
|
| 31 | * @param string $code |
|
| 32 | * @param string $message |
|
| 33 | */ |
|
| 34 | public function __construct(string $protocol, string $code, string $message) |
|
| 35 | { |
|
| 36 | $this->protocol = $protocol; |
|
| 37 | $this->code = $code; |
|
| 38 | $this->message = $message; |
|
| 39 | } |
|
| 40 | ||
| 41 | /** |
|
| 42 | * @return string |
|
| 43 | */ |
|
| 44 | public function getProtocol(): string |
|
| 45 | { |
|
| 46 | return $this->protocol; |
|
| 47 | } |
|
| 48 | ||
| 49 | /** |
|
| 50 | * @param string $protocol |
|
| 51 | * @return HttpResponseHeader |
|
| 52 | */ |
|
| 53 | public function setProtocol(string $protocol): HttpResponseHeader |
|
| 54 | { |
|
| 55 | $this->protocol = $protocol; |
|
| 56 | return $this; |
|
| 57 | } |
|
| 58 | ||
| 59 | /** |
|
| 60 | * @return string |
|
| 61 | */ |
|
| 62 | public function getCode(): string |
|
| 63 | { |
|
| 64 | return $this->code; |
|
| 65 | } |
|
| 66 | ||
| 67 | /** |
|
| 68 | * @param string $code |
|
| 69 | * @return HttpResponseHeader |
|
| 70 | */ |
|
| 71 | public function setCode(string $code): HttpResponseHeader |
|
| 72 | { |
|
| 73 | $this->code = $code; |
|
| 74 | return $this; |
|
| 75 | } |
|
| 76 | ||
| 77 | /** |
|
| 78 | * @return string |
|
| 79 | */ |
|
| 80 | public function getMessage(): string |
|
| 81 | { |
|
| 82 | return $this->message; |
|
| 83 | } |
|
| 84 | ||
| 85 | /** |
|
| 86 | * @param string $message |
|
| 87 | * @return HttpResponseHeader |
|
| 88 | */ |
|
| 89 | public function setMessage(string $message): HttpResponseHeader |
|
| 90 | { |
|
| 91 | $this->message = $message; |
|
| 92 | return $this; |
|
| 93 | } |
|
| 94 | } |
|