1 | <?php |
||
21 | class Response extends AbstractResponse |
||
22 | { |
||
23 | /** |
||
24 | * @param array $array |
||
25 | * @param array $headers |
||
26 | * @return ResponseFactory |
||
27 | */ |
||
28 | public function withArray(array $array, array $headers = []) |
||
32 | |||
33 | /** |
||
34 | * Respond with a paginator, and a transformer. |
||
35 | * |
||
36 | * @param LengthAwarePaginator $paginator |
||
37 | * @param callable|\League\Fractal\TransformerAbstract $transformer |
||
38 | * @param string $resourceKey |
||
39 | * @param array $meta |
||
40 | * @return ResponseFactory |
||
41 | */ |
||
42 | 1 | public function withPaginator(LengthAwarePaginator $paginator, $transformer, $resourceKey = null, $meta = []) |
|
58 | |||
59 | /** |
||
60 | * Generates a Response with a 400 HTTP header and a given message from validator |
||
61 | * |
||
62 | * @param Validator $validator |
||
63 | * @return ResponseFactory |
||
64 | */ |
||
65 | 1 | public function errorWrongArgsValidator(Validator $validator) |
|
69 | } |
||
70 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: