ReviewWord
in package
Entity representing a word being reviewed.
Contains all word data needed for the test interface including the word itself, translation, sentence context, and scoring info.
Tags
Table of Contents
Properties
- $daysOld : int
- $id : int
- $languageId : int
- $romanization : string|null
- $score : int
- $sentence : string|null
- $status : int
- $text : string
- $textLowercase : string
- $translation : string
Methods
- __construct() : mixed
- Constructor.
- fromRecord() : self
- Create from database record.
- getSentenceForDisplay() : string
- Get sentence for display (with word marked).
- hasSentence() : bool
- Check if word has a sentence context.
- isIgnored() : bool
- Check if word is ignored (status 98).
- isLearning() : bool
- Check if word is in learning status (1-5).
- isWellKnown() : bool
- Check if word is well-known (status 99).
- needsNewSentence() : bool
- Check if the stored sentence needs updating.
- toArray() : array<string|int, mixed>
- Convert to array for JSON response.
Properties
$daysOld read-only
public
int
$daysOld
$id read-only
public
int
$id
$languageId read-only
public
int
$languageId
$romanization read-only
public
string|null
$romanization
$score read-only
public
int
$score
$sentence read-only
public
string|null
$sentence
$status read-only
public
int
$status
$text read-only
public
string
$text
$textLowercase read-only
public
string
$textLowercase
$translation read-only
public
string
$translation
Methods
__construct()
Constructor.
public
__construct(int $id, string $text, string $textLowercase, string $translation, string|null $romanization, string|null $sentence, int $languageId, int $status, int $score, int $daysOld) : mixed
Parameters
- $id : int
-
Word ID
- $text : string
-
Word text
- $textLowercase : string
-
Lowercase word text
- $translation : string
-
Translation
- $romanization : string|null
-
Romanization (optional)
- $sentence : string|null
-
Sentence context (optional)
- $languageId : int
-
Language ID
- $status : int
-
Current status (1-5, 98, 99)
- $score : int
-
Today's score
- $daysOld : int
-
Days since status changed
fromRecord()
Create from database record.
public
static fromRecord(array<string, mixed> $record) : self
Parameters
- $record : array<string, mixed>
-
Database record
Return values
selfgetSentenceForDisplay()
Get sentence for display (with word marked).
public
getSentenceForDisplay() : string
If no sentence exists, returns the word wrapped in braces.
Return values
string —Sentence with word marked
hasSentence()
Check if word has a sentence context.
public
hasSentence() : bool
Tags
Return values
boolisIgnored()
Check if word is ignored (status 98).
public
isIgnored() : bool
Return values
boolisLearning()
Check if word is in learning status (1-5).
public
isLearning() : bool
Return values
boolisWellKnown()
Check if word is well-known (status 99).
public
isWellKnown() : bool
Return values
boolneedsNewSentence()
Check if the stored sentence needs updating.
public
needsNewSentence() : bool
A sentence needs updating if it doesn't contain the word marked with curly braces.
Return values
bool —True if sentence is invalid/missing
toArray()
Convert to array for JSON response.
public
toArray() : array<string|int, mixed>