Refactor Classes
This commit is contained in:
@@ -4,7 +4,9 @@ namespace TorstenHettstedt\TimekeepingApi\Controller;
|
||||
|
||||
use JsonSerializable;
|
||||
use PDO;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Slim\Psr7\Response;
|
||||
|
||||
abstract class AbstractController
|
||||
@@ -18,6 +20,8 @@ abstract class AbstractController
|
||||
* @param ContainerInterface $container
|
||||
*
|
||||
* @throws NotDatabasesException
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
@@ -34,7 +38,8 @@ abstract class AbstractController
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
protected function printResponse(Response $response, mixed $data, int $status_code): Response {
|
||||
protected function printResponse(Response $response, mixed $data, int $status_code): Response
|
||||
{
|
||||
$payload = json_encode($data);
|
||||
|
||||
$response->getBody()->write($payload);
|
||||
|
||||
Reference in New Issue
Block a user