Limpieza de objetos externos
This commit is contained in:
24
api/common/Controller/Base.php
Normal file
24
api/common/Controller/Base.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace Common\Controller;
|
||||
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use function Safe\{json_decode, file_get_contents};
|
||||
use ProVM\Alias\Controller\Json;
|
||||
|
||||
class Base
|
||||
{
|
||||
use Json;
|
||||
|
||||
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, ContainerInterface $container): ResponseInterface
|
||||
{
|
||||
$folder = $container->get('folders')->documentation;
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||
$folder,
|
||||
'base.json'
|
||||
]);
|
||||
$documentation = json_decode(file_get_contents($filename));
|
||||
return $this->withJson($response, $documentation);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user