get($fecha); $output = [ 'uf' => [ 'date' => $fecha->format('Y-m-d'), 'value' => $valor ], 'total' => 1 ]; $response->getBody()->write(json_encode($output)); return $response ->withHeader('Content-Type', 'application/json') ->withStatus(201); } public function fecha(Request $request, Response $response, UFHandler $handler, $fecha): Response { $fecha = Carbon::parse($fecha); $valor = $handler->get($fecha); $output = [ 'uf' => [ 'date' => $fecha->format('Y-m-d'), 'value' => $valor ], 'total' => 1 ]; $response->getBody()->write(json_encode($output)); return $response ->withHeader('Content-Type', 'application/json') ->withStatus(201); } }