| Total Complexity | 8 |
| Total Lines | 77 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | abstract class Response |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var array |
||
| 16 | */ |
||
| 17 | protected $config = []; |
||
| 18 | /** |
||
| 19 | * @var Message |
||
| 20 | */ |
||
| 21 | protected $message; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Returns the HTTP Code of the response |
||
| 25 | * |
||
| 26 | * @return int |
||
| 27 | */ |
||
| 28 | public function code(): int |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Returns the content type of the messe part of the response |
||
| 35 | * |
||
| 36 | * @return string |
||
| 37 | */ |
||
| 38 | public function contentType(): string |
||
| 39 | { |
||
| 40 | return $this->message->contentType(); |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Returns the `alkemann\Message` object part of the response |
||
| 45 | * |
||
| 46 | * @return Message |
||
| 47 | */ |
||
| 48 | public function message(): ?Message |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @throws \Error if the configured `header_func` is not callable |
||
| 55 | */ |
||
| 56 | protected function setHeaders(): void |
||
| 70 | } |
||
| 71 | } |
||
| 72 | |||
| 73 | /** |
||
| 74 | * Shorthand for rendering the Response object |
||
| 75 | * |
||
| 76 | * Returns the result of calling Response::render() |
||
| 77 | */ |
||
| 78 | public function __toString(): string |
||
| 81 | } |
||
| 82 | |||
| 83 | /** |
||
| 84 | * All subclasses of Response must implement render to return the string body |
||
| 85 | * |
||
| 86 | * @return string |
||
| 87 | */ |
||
| 88 | abstract public function render(): string; |
||
| 89 | } |
||
| 90 |