1 | <?php |
||
18 | abstract class ResponseBuilder implements Arrayable, Jsonable |
||
19 | { |
||
20 | /** |
||
21 | * A factory for making responses. |
||
22 | * |
||
23 | * @var \Flugg\Responder\Http\Responses\Factories\ResponseFactory |
||
24 | */ |
||
25 | protected $responseFactory; |
||
26 | |||
27 | /** |
||
28 | * A HTTP status code for the response. |
||
29 | * |
||
30 | * @var int |
||
31 | */ |
||
32 | protected $status; |
||
33 | |||
34 | /** |
||
35 | * Construct the builder class. |
||
36 | * |
||
37 | * @param \Flugg\Responder\Contracts\ResponseFactory $responseFactory |
||
38 | */ |
||
39 | 22 | public function __construct(ResponseFactory $responseFactory) |
|
43 | |||
44 | /** |
||
45 | * Decorate the response with the given decorator. |
||
46 | * |
||
47 | * @param string[]|string $decorator |
||
48 | * @return $this |
||
49 | */ |
||
50 | public function decorator($decorator) |
||
60 | |||
61 | /** |
||
62 | * Respond with a successful response. |
||
63 | * |
||
64 | * @param int|null $status |
||
65 | 12 | * @param array $headers |
|
66 | * @return \Illuminate\Http\JsonResponse |
||
67 | 12 | */ |
|
68 | public function respond(int $status = null, array $headers = []): JsonResponse |
||
76 | |||
77 | 2 | /** |
|
78 | * Convert the response to an array. |
||
79 | * |
||
80 | * @return array |
||
81 | */ |
||
82 | public function toArray(): array |
||
86 | 4 | ||
87 | /** |
||
88 | 4 | * Convert the response to an Illuminate collection. |
|
89 | * |
||
90 | * @return \Illuminate\Support\Collection |
||
91 | */ |
||
92 | public function toCollection(): Collection |
||
96 | |||
97 | 4 | /** |
|
98 | * Convert the response to JSON. |
||
99 | 4 | * |
|
100 | 2 | * @param int $options |
|
101 | * @return string |
||
102 | */ |
||
103 | public function toJson($options = 0): string |
||
107 | |||
108 | /** |
||
109 | * Set the HTTP status code for the response. |
||
110 | * |
||
111 | * @param int $status |
||
112 | * @return void |
||
113 | */ |
||
114 | protected function setStatusCode(int $status) |
||
118 | |||
119 | /** |
||
120 | * Get the serialized response output. |
||
121 | * |
||
122 | * @return array |
||
123 | */ |
||
124 | abstract protected function getOutput(): array; |
||
125 | |||
126 | /** |
||
127 | * Convert the response to an array. |
||
128 | * |
||
129 | * @param int $status |
||
130 | * @return void |
||
131 | */ |
||
132 | abstract protected function validateStatusCode(int $status); |
||
133 | } |
||
134 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..