1 | <?php |
||
16 | class Response |
||
17 | { |
||
18 | public |
||
19 | $code, |
||
20 | $errorCode, |
||
21 | $error, |
||
22 | $header, |
||
23 | $body, |
||
24 | /** |
||
25 | * @var Request |
||
26 | */ |
||
27 | $request, |
||
28 | $contentType, |
||
29 | $charset, |
||
30 | $duration, |
||
31 | $info; |
||
32 | protected function __construct() |
||
35 | |||
36 | public static function create(Request $request, $body, $info, $errorCode, $error){ |
||
76 | 2 | ||
77 | /** |
||
78 | 1 | * Status Code Definitions |
|
79 | * |
||
80 | 2 | * Informational 1xx |
|
81 | 2 | * Successful 2xx |
|
82 | * Redirection 3xx |
||
83 | 2 | * Client Error 4xx |
|
84 | 2 | * Server Error 5xx |
|
85 | 2 | * |
|
86 | 2 | * http://pretty-rfc.herokuapp.com/RFC2616#status.codes |
|
87 | 2 | * |
|
88 | 2 | * @return bool Did we receive a 4xx or 5xx? |
|
89 | 2 | */ |
|
90 | 2 | public function hasErrors() |
|
94 | |||
95 | } |
Only declaring a single property per statement allows you to later on add doc comments more easily.
It is also recommended by PSR2, so it is a common style that many people expect.