CountdownRepositoryInterface
in
Describes behavior of the countdown repository
Table of Contents
Methods
- add() : int
- Persists a new countdown entity.
- delete() : bool
- Deletes a countdown by its ID.
- findAll() : array<string|int, Countdown>
- Retrieves all countdowns from storage.
- findById() : Countdown|null
- Finds a countdown by its ID.
- findCurrent() : Countdown|null
- Finds the current active countdown (with count_to in the future).
- update() : bool
- Updates an existing countdown entity.
- updateField() : bool
- Updates a specific field in a countdown.
Methods
add()
Persists a new countdown entity.
public
add(Countdown $countdown) : int
Parameters
- $countdown : Countdown
-
The countdown entity to add
Tags
Return values
int —The ID of the newly inserted countdown
delete()
Deletes a countdown by its ID.
public
delete(int $id) : bool
Parameters
- $id : int
-
The countdown ID to delete
Tags
Return values
bool —True if deletion was successful, false otherwise
findAll()
Retrieves all countdowns from storage.
public
findAll() : array<string|int, Countdown>
Tags
Return values
array<string|int, Countdown> —Array of all countdown entities
findById()
Finds a countdown by its ID.
public
findById(int $id) : Countdown|null
Parameters
- $id : int
-
The countdown ID
Tags
Return values
Countdown|null —The countdown entity or null if not found
findCurrent()
Finds the current active countdown (with count_to in the future).
public
findCurrent() : Countdown|null
Returns the next countdown to occur.
Tags
Return values
Countdown|null —The current countdown or null if none exists
update()
Updates an existing countdown entity.
public
update(Countdown $countdown) : bool
Parameters
- $countdown : Countdown
-
The countdown entity with updated data
Tags
Return values
bool —True if update was successful, false otherwise
updateField()
Updates a specific field in a countdown.
public
updateField(int $id, string $field, string $value) : bool
Parameters
- $id : int
-
The countdown ID
- $field : string
-
The field name to update
- $value : string
-
The new value for the field
Tags
Return values
bool —True if the update was successful, false otherwise