Conditions | 3 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
22 | public static function factory($typeResponse, Request $request, Response $response) |
||
23 | { |
||
24 | if(is_bool($typeResponse)) { |
||
25 | return $response->setContent((string)$typeResponse)->send(); |
||
26 | } |
||
27 | $baseResponse = RouteResponse::create($typeResponse); |
||
28 | if(is_array($typeResponse)) { |
||
29 | return (new JsonResponse($baseResponse, $request, $response))->render(); |
||
30 | } |
||
31 | return (new TextPlainResponse($baseResponse, $request, $response))->render(); |
||
32 | } |
||
33 | } |