@@ -12,21 +12,21 @@ discard block |
||
12 | 12 | |
13 | 13 | interface ResponseFactory |
14 | 14 | { |
15 | - public function make(string $content = '', int $status = 200, array $headers = []): Response; |
|
15 | + public function make(string $content = '', int $status = 200, array $headers = [ ]): Response; |
|
16 | 16 | |
17 | - public function noContent(int $status = Response::HTTP_NO_CONTENT, array $headers = []): Response; |
|
17 | + public function noContent(int $status = Response::HTTP_NO_CONTENT, array $headers = [ ]): Response; |
|
18 | 18 | |
19 | 19 | public function json( |
20 | - array $data = [], |
|
20 | + array $data = [ ], |
|
21 | 21 | int $status = Response::HTTP_OK, |
22 | - array $headers = [], |
|
22 | + array $headers = [ ], |
|
23 | 23 | int $options = 0 |
24 | 24 | ): JsonResponse; |
25 | 25 | |
26 | 26 | public function paginator( |
27 | 27 | LengthAwarePaginator $paginator, |
28 | 28 | int $status = Response::HTTP_OK, |
29 | - array $headers = [], |
|
29 | + array $headers = [ ], |
|
30 | 30 | int $options = 0 |
31 | 31 | ): JsonResponse; |
32 | 32 | |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | LengthAwarePaginator $paginator, |
35 | 35 | callable $map, |
36 | 36 | int $status = Response::HTTP_OK, |
37 | - array $headers = [], |
|
37 | + array $headers = [ ], |
|
38 | 38 | int $options = 0 |
39 | 39 | ): JsonResponse; |
40 | 40 | |
41 | - public function stream(callable $callback, int $status = Response::HTTP_OK, array $headers = []): StreamedResponse; |
|
41 | + public function stream(callable $callback, int $status = Response::HTTP_OK, array $headers = [ ]): StreamedResponse; |
|
42 | 42 | |
43 | - public function redirectTo(string $path, int $status = Response::HTTP_FOUND, array $headers = []): RedirectResponse; |
|
43 | + public function redirectTo(string $path, int $status = Response::HTTP_FOUND, array $headers = [ ]): RedirectResponse; |
|
44 | 44 | } |
@@ -22,24 +22,24 @@ discard block |
||
22 | 22 | $this->redirector = $redirector; |
23 | 23 | } |
24 | 24 | |
25 | - public function make(string $content = '', int $status = Response::HTTP_OK, array $headers = []): Response |
|
25 | + public function make(string $content = '', int $status = Response::HTTP_OK, array $headers = [ ]): Response |
|
26 | 26 | { |
27 | 27 | return new Response($content, $status, $headers); |
28 | 28 | } |
29 | 29 | |
30 | - public function noContent(int $status = Response::HTTP_NO_CONTENT, array $headers = []): Response |
|
30 | + public function noContent(int $status = Response::HTTP_NO_CONTENT, array $headers = [ ]): Response |
|
31 | 31 | { |
32 | 32 | return $this->make('', $status, $headers); |
33 | 33 | } |
34 | 34 | |
35 | 35 | public function json( |
36 | - array $data = [], |
|
36 | + array $data = [ ], |
|
37 | 37 | int $status = Response::HTTP_OK, |
38 | - array $headers = [], |
|
38 | + array $headers = [ ], |
|
39 | 39 | int $options = 0 |
40 | 40 | ): JsonResponse { |
41 | - if (! array_key_exists('data', $data)) { |
|
42 | - $data = ['data' => $data]; |
|
41 | + if (!array_key_exists('data', $data)) { |
|
42 | + $data = [ 'data' => $data ]; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | return new JsonResponse($data, $status, $headers, $options); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | public function paginator( |
49 | 49 | LengthAwarePaginator $paginator, |
50 | 50 | int $status = Response::HTTP_OK, |
51 | - array $headers = [], |
|
51 | + array $headers = [ ], |
|
52 | 52 | int $options = 0 |
53 | 53 | ): JsonResponse { |
54 | 54 | return $this->json([ |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | LengthAwarePaginator $paginator, |
69 | 69 | callable $map, |
70 | 70 | int $status = Response::HTTP_OK, |
71 | - array $headers = [], |
|
71 | + array $headers = [ ], |
|
72 | 72 | int $options = 0 |
73 | 73 | ): JsonResponse { |
74 | 74 | $paginator->setCollection($paginator->getCollection()->map($map)); |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | return $this->paginator($paginator, $status, $headers, $options); |
77 | 77 | } |
78 | 78 | |
79 | - public function stream(callable $callback, int $status = Response::HTTP_OK, array $headers = []): StreamedResponse |
|
79 | + public function stream(callable $callback, int $status = Response::HTTP_OK, array $headers = [ ]): StreamedResponse |
|
80 | 80 | { |
81 | 81 | return new StreamedResponse($callback, $status, $headers); |
82 | 82 | } |
83 | 83 | |
84 | - public function redirectTo(string $path, int $status = Response::HTTP_FOUND, array $headers = []): RedirectResponse |
|
84 | + public function redirectTo(string $path, int $status = Response::HTTP_FOUND, array $headers = [ ]): RedirectResponse |
|
85 | 85 | { |
86 | 86 | return $this->redirector->to($path, $status, $headers, true); |
87 | 87 | } |