1 | <?php |
||
16 | class UserShowJsonResponder |
||
17 | { |
||
18 | /** |
||
19 | * @var ResponseFactoryInterface |
||
20 | */ |
||
21 | private $responseFactory; |
||
22 | |||
23 | /** |
||
24 | * @var StreamFactoryInterface |
||
25 | */ |
||
26 | private $streamFactory; |
||
27 | |||
28 | /** |
||
29 | * @param ResponseFactoryInterface $responseFactory |
||
30 | * @param StreamFactoryInterface $streamFactory |
||
31 | */ |
||
32 | 1 | public function __construct(ResponseFactoryInterface $responseFactory, StreamFactoryInterface $streamFactory) |
|
37 | |||
38 | /** |
||
39 | * @param User|null $user |
||
40 | * @return ResponseInterface |
||
41 | */ |
||
42 | 1 | public function respond(User $user = null): ResponseInterface |
|
55 | |||
56 | /** |
||
57 | * @param array|JsonSerializable $body |
||
58 | * @param int $status |
||
59 | * @return ResponseInterface |
||
60 | */ |
||
61 | 1 | private function createJsonResponse($body, int $status): ResponseInterface |
|
68 | } |
||
69 |