CountdownController
extends BaseController
in package
FinalYes
Table of Contents
Properties
- $renderer : ViewRendererInterface
- $requestContext : RequestContext
- $createCountdownUseCase : CreateCountdownUseCase
- $deleteCountdownUseCase : DeleteCountdownUseCase
- $getAllCountdownsUseCase : GetAllCountdownsUseCase
- $getAllUsersUseCase : GetAllUsersUseCase
- $logger : LoggerInterface
- $request : ServerRequestInterface
- $translator : Translator
- $updateCountdownUseCase : UpdateCountdownUseCase
Methods
- __construct() : mixed
- add() : ResponseInterface
- Create countdown via API POST /api/countdown
- delete() : ResponseInterface
- Delete countdown via API DELETE /api/countdown/{id}
- getAll() : ResponseInterface
- Get all countdowns via API.
- update() : ResponseInterface
- Update countdown via API PATCH /api/countdown/{id}
- getCurrentUserId() : int|null
- jsonResponse() : ResponseInterface
- JSON response helper
- noContentResponse() : ResponseInterface
- No content response helper
- redirect() : ResponseInterface
- Redirect to URL
- render() : ResponseInterface
- Render view and return as response
- buildUsernamesMap() : array<string|int, mixed>
- Build map of user IDs to usernames for display purposes.
- formatCountdowns() : array<string|int, mixed>
- Format countdown objects for API response.
Properties
$renderer
public
ViewRendererInterface
$renderer
$requestContext
public
RequestContext
$requestContext
$createCountdownUseCase read-only
private
CreateCountdownUseCase
$createCountdownUseCase
$deleteCountdownUseCase read-only
private
DeleteCountdownUseCase
$deleteCountdownUseCase
$getAllCountdownsUseCase read-only
private
GetAllCountdownsUseCase
$getAllCountdownsUseCase
$getAllUsersUseCase read-only
private
GetAllUsersUseCase
$getAllUsersUseCase
$logger read-only
private
LoggerInterface
$logger
$request read-only
private
ServerRequestInterface
$request
$translator read-only
private
Translator
$translator
$updateCountdownUseCase read-only
private
UpdateCountdownUseCase
$updateCountdownUseCase
Methods
__construct()
public
__construct(RequestContext $requestContext, ViewRendererInterface $renderer, ServerRequestInterface $request, LoggerInterface $logger, Translator $translator, CreateCountdownUseCase $createCountdownUseCase, DeleteCountdownUseCase $deleteCountdownUseCase, UpdateCountdownUseCase $updateCountdownUseCase, GetAllCountdownsUseCase $getAllCountdownsUseCase, GetAllUsersUseCase $getAllUsersUseCase) : mixed
Parameters
- $requestContext : RequestContext
- $renderer : ViewRendererInterface
- $request : ServerRequestInterface
- $logger : LoggerInterface
- $translator : Translator
- $createCountdownUseCase : CreateCountdownUseCase
- $deleteCountdownUseCase : DeleteCountdownUseCase
- $updateCountdownUseCase : UpdateCountdownUseCase
- $getAllCountdownsUseCase : GetAllCountdownsUseCase
- $getAllUsersUseCase : GetAllUsersUseCase
add()
Create countdown via API POST /api/countdown
public
add() : ResponseInterface
Tags
Return values
ResponseInterfacedelete()
Delete countdown via API DELETE /api/countdown/{id}
public
delete([array<string|int, mixed> $vars = [] ]) : ResponseInterface
Parameters
- $vars : array<string|int, mixed> = []
Return values
ResponseInterfacegetAll()
Get all countdowns via API.
public
getAll() : ResponseInterface
GET /api/countdowns
Tags
Return values
ResponseInterfaceupdate()
Update countdown via API PATCH /api/countdown/{id}
public
update([array<string|int, mixed> $vars = [] ]) : ResponseInterface
Parameters
- $vars : array<string|int, mixed> = []
Tags
Return values
ResponseInterfacegetCurrentUserId()
protected
getCurrentUserId() : int|null
Tags
Return values
int|nulljsonResponse()
JSON response helper
protected
jsonResponse(int $statusCode, array<string|int, mixed> $data[, array<string|int, mixed> $headers = [] ]) : ResponseInterface
Parameters
- $statusCode : int
- $data : array<string|int, mixed>
- $headers : array<string|int, mixed> = []
Return values
ResponseInterfacenoContentResponse()
No content response helper
protected
noContentResponse([int $statusCode = 204 ]) : ResponseInterface
Parameters
- $statusCode : int = 204
Return values
ResponseInterfaceredirect()
Redirect to URL
protected
redirect(string $location[, int $statusCode = 302 ]) : ResponseInterface
Parameters
- $location : string
- $statusCode : int = 302
Return values
ResponseInterfacerender()
Render view and return as response
protected
render(string $view[, array<string|int, mixed> $data = [] ][, int $statusCode = 200 ]) : ResponseInterface
Parameters
- $view : string
- $data : array<string|int, mixed> = []
- $statusCode : int = 200
Return values
ResponseInterfacebuildUsernamesMap()
Build map of user IDs to usernames for display purposes.
private
buildUsernamesMap(array<string|int, mixed> $users) : array<string|int, mixed>
Parameters
- $users : array<string|int, mixed>
Return values
array<string|int, mixed>formatCountdowns()
Format countdown objects for API response.
private
formatCountdowns(array<string|int, mixed> $countdowns, array<string|int, mixed> $usernames) : array<string|int, mixed>
Parameters
- $countdowns : array<string|int, mixed>
- $usernames : array<string|int, mixed>