ReviewSession
in package
Entity representing an active review session.
Tracks progress through a vocabulary test including start time, total words, and correct/wrong counts.
Tags
Table of Contents
Properties
- $correct : int
- $startTime : int
- $total : int
- $wrong : int
Methods
- __construct() : mixed
- Constructor.
- getCorrect() : int
- Get correct answers count.
- getStartTime() : int
- Get start time.
- getTotal() : int
- Get total words count.
- getWrong() : int
- Get wrong answers count.
- isFinished() : bool
- Check if session is finished.
- recordAnswer() : void
- Record an answer based on status change direction.
- recordCorrect() : void
- Record a correct answer.
- recordWrong() : void
- Record a wrong answer.
- remaining() : int
- Get remaining words to test.
- start() : self
- Start a new review session.
- toArray() : array{start: int, total: int, correct: int, wrong: int, remaining: int}
- Convert to array for serialization.
Properties
$correct
private
int
$correct
$startTime
private
int
$startTime
$total
private
int
$total
$wrong
private
int
$wrong
Methods
__construct()
Constructor.
public
__construct(int $startTime, int $total[, int $correct = 0 ][, int $wrong = 0 ]) : mixed
Parameters
- $startTime : int
-
Unix timestamp when session started
- $total : int
-
Total number of words to test
- $correct : int = 0
-
Number of correct answers (default 0)
- $wrong : int = 0
-
Number of wrong answers (default 0)
getCorrect()
Get correct answers count.
public
getCorrect() : int
Return values
int —Correct count
getStartTime()
Get start time.
public
getStartTime() : int
Return values
int —Unix timestamp
getTotal()
Get total words count.
public
getTotal() : int
Return values
int —Total words
getWrong()
Get wrong answers count.
public
getWrong() : int
Return values
int —Wrong count
isFinished()
Check if session is finished.
public
isFinished() : bool
Return values
bool —True if no words remaining
recordAnswer()
Record an answer based on status change direction.
public
recordAnswer(int $statusChange) : void
Parameters
- $statusChange : int
-
-1 for wrong, 0 or positive for correct
recordCorrect()
Record a correct answer.
public
recordCorrect() : void
recordWrong()
Record a wrong answer.
public
recordWrong() : void
remaining()
Get remaining words to test.
public
remaining() : int
Return values
int —Number of remaining words
start()
Start a new review session.
public
static start(int $total) : self
Parameters
- $total : int
-
Total number of words to test
Return values
self —New session with current time as start
toArray()
Convert to array for serialization.
public
toArray() : array{start: int, total: int, correct: int, wrong: int, remaining: int}