1 | <?php |
||
22 | class Response |
||
23 | { |
||
24 | public |
||
25 | $code, |
||
26 | $errorCode, |
||
27 | $error, |
||
28 | $header, |
||
29 | $body, |
||
30 | /** |
||
31 | * @var Request |
||
32 | */ |
||
33 | $request, |
||
34 | $contentType, |
||
35 | $charset, |
||
36 | $duration, |
||
37 | $info; |
||
38 | |||
39 | /** |
||
40 | * Response constructor. |
||
41 | */ |
||
42 | 6 | protected function __construct() |
|
45 | |||
46 | /** |
||
47 | * @param Request $request |
||
48 | * @param $body |
||
49 | * @param $info |
||
50 | * @param $errorCode |
||
51 | * @param $error |
||
52 | * @return Response |
||
53 | */ |
||
54 | 6 | public static function create(Request $request, $body, $info, $errorCode, $error) |
|
64 | |||
65 | |||
66 | |||
67 | 5 | public function parse() |
|
105 | /** |
||
106 | * Status Code Definitions |
||
107 | * |
||
108 | * Informational 1xx |
||
109 | * Successful 2xx |
||
110 | * Redirection 3xx |
||
111 | * Client Error 4xx |
||
112 | * Server Error 5xx |
||
113 | * |
||
114 | * http://pretty-rfc.herokuapp.com/RFC2616#status.codes |
||
115 | * |
||
116 | * @return bool Did we receive a 4xx or 5xx? |
||
117 | */ |
||
118 | 2 | public function hasErrors() |
|
122 | |||
123 | } |
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.