Files
KI/common/Controller/Web/Indicadores.php
2020-05-12 19:12:54 -04:00

24 lines
709 B
PHP

<?php
namespace ProVM\KI\Common\Controller\Web;
use Psr\Container\ContainerInterface as Container;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use Carbon\Carbon;
use ProVM\KI\Common\Service\Indicadores as Service;
class Indicadores {
public function get(Request $request, Response $response, Container $container, Service $service, $indicador) {
$valor = $service->get($indicador, Carbon::today());
$output = [
'sim' => $indicador,
'valor' => $valor,
];
$response->getBody()->write(json_encode($output));
return $response
->withHeader('Content-Type', 'application/json')
->withStatus(201);
}
}