ScheduleTimeSlotController
extends BaseController
in package
Controller class for handling schedule time slots.
Tags
Table of Contents
- $path : string
- $routes : array<string|int, mixed>
- $path : string
- $routes : array<string|int, mixed>
- $scheduleTimeSlotService : ScheduleTimeSlotService
- __construct() : mixed
- addApiRoutes() : void
- Create a RouteGroup for the controller and add the routes to it.
- countAppointments() : ResponseInterface
- Count appointments for a schedule time slot.
- delete() : ResponseInterface
- Delete a schedule time slot.
- checkParams() : void
- Check the given parameters against the given schema.
- makeJsonResponse() : ResponseInterface
- Create a JSON response with the given result and status code.
- addRoutes() : void
- Add routes to the given group.
Properties
$path
public
string
$path
The path of the controller (e.g. /appointment).
$routes
public
array<string|int, mixed>
$routes
The routes for the controller. The routes should be an array of arrays with the following keys: method, path, handler.
$path
protected
string
$path
= '/schedule-time-slot'
The path of the controller.
$routes
protected
array<string|int, mixed>
$routes
= [['method' => 'GET', 'path' => '/count-appointments/{schedule_time_slot_id}', 'handler' => 'countAppointments'], ['method' => 'DELETE', 'path' => '/{schedule_time_slot_id}', 'handler' => 'delete']]
The routes for the controller.
$scheduleTimeSlotService
private
ScheduleTimeSlotService
$scheduleTimeSlotService
The schedule time slot service.
Methods
__construct()
public
__construct(ScheduleTimeSlotService $scheduleTimeSlotService) : mixed
Parameters
- $scheduleTimeSlotService : ScheduleTimeSlotService
Return values
mixed —addApiRoutes()
Create a RouteGroup for the controller and add the routes to it.
public
addApiRoutes(RouteCollectorProxy $group) : void
Parameters
- $group : RouteCollectorProxy
-
The route group.
Tags
Return values
void —countAppointments()
Count appointments for a schedule time slot.
public
countAppointments(ServerRequestInterface $request, ResponseInterface $response, array<string|int, mixed> $args) : ResponseInterface
Parameters
- $request : ServerRequestInterface
-
The request object.
- $response : ResponseInterface
-
The response object.
- $args : array<string|int, mixed>
-
The arguments for the request.
Tags
Return values
ResponseInterface —delete()
Delete a schedule time slot.
public
delete(ServerRequestInterface $request, ResponseInterface $response, array<string|int, mixed> $args) : ResponseInterface
Parameters
- $request : ServerRequestInterface
-
The request object.
- $response : ResponseInterface
-
The response object.
- $args : array<string|int, mixed>
-
The arguments for the request.
Tags
Return values
ResponseInterface —checkParams()
Check the given parameters against the given schema.
protected
checkParams(array<string|int, mixed> $params, array<string|int, mixed> $schema) : void
Parameters
- $params : array<string|int, mixed>
-
The parameters to check.
- $schema : array<string|int, mixed>
-
The schema to check against. The schema should be an array of arrays with the following keys: type, required, not_blank, min_number, max_number, min_length, max_length, regex, properties, items. The type can be one of the following: integer, string, boolean, object, array.
Tags
Return values
void —makeJsonResponse()
Create a JSON response with the given result and status code.
protected
makeJsonResponse(ResponseInterface $response[, mixed $result = null ][, int $status_code = 200 ]) : ResponseInterface
Parameters
- $response : ResponseInterface
-
The PSR-7 response.
- $result : mixed = null
-
The data to be included in the JSON response.
- $status_code : int = 200
-
The HTTP status code for the response (default is 200).
Return values
ResponseInterface —The PSR-7 response with JSON data and appropriate headers.
addRoutes()
Add routes to the given group.
private
addRoutes(RouteCollectorProxy $newGroup) : void
Parameters
- $newGroup : RouteCollectorProxy
-
The route group.