Documentation

ReviewWord
in package

FinalYes

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
since
3.0.0

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

$romanization read-only

public string|null $romanization

$sentence read-only

public string|null $sentence

$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
self

getSentenceForDisplay()

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
psalm-assert-if-true

non-empty-string $this->sentence

Return values
bool

isIgnored()

Check if word is ignored (status 98).

public isIgnored() : bool
Return values
bool

isLearning()

Check if word is in learning status (1-5).

public isLearning() : bool
Return values
bool

isWellKnown()

Check if word is well-known (status 99).

public isWellKnown() : bool
Return values
bool

needsNewSentence()

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>
Return values
array<string|int, mixed>

        
On this page

Search results