GetNextTerm
in package
Use case for fetching the next term to test.
Retrieves the next word using spaced repetition algorithm, gets sentence context, and formats the solution.
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- Constructor.
- execute() : ReviewWord}
- Get the next term for testing.
- formatTermForTest() : array{0: string, 1: string}
- Format term for test display.
- getSentenceForWord() : string
- Get sentence for word based on mode.
- getSolution() : string
- Get solution text for the test.
Properties
$repository
private
ReviewRepositoryInterface
$repository
Methods
__construct()
Constructor.
public
__construct(ReviewRepositoryInterface $repository) : mixed
Parameters
- $repository : ReviewRepositoryInterface
-
Review repository
execute()
Get the next term for testing.
public
execute(ReviewConfiguration $config) : ReviewWord}
Parameters
- $config : ReviewConfiguration
-
Test configuration
Return values
ReviewWord}formatTermForTest()
Format term for test display.
private
formatTermForTest(ReviewWord $word, string $sentence, int $testType) : array{0: string, 1: string}
Parameters
- $word : ReviewWord
-
Word entity
- $sentence : string
-
Sentence containing the word
- $testType : int
-
Test type (1-5)
Return values
array{0: string, 1: string} —[HTML display, plain word text]
getSentenceForWord()
Get sentence for word based on mode.
private
getSentenceForWord(ReviewWord $word, bool $wordMode) : string
Parameters
- $word : ReviewWord
-
The word
- $wordMode : bool
-
Whether in word mode
Return values
string —Sentence with word marked
getSolution()
Get solution text for the test.
private
getSolution(int $testType, ReviewWord $word, bool $wordMode, string $wordText) : string
Parameters
- $testType : int
-
Test type
- $word : ReviewWord
-
Word entity
- $wordMode : bool
-
Word mode flag
- $wordText : string
-
Displayed word text
Return values
string —Solution text