ReviewConfiguration
in package
Value object representing review configuration parameters.
Immutable after creation. Encapsulates review type, selection mode, and other review parameters.
Tags
Table of Contents
Constants
- KEY_LANG = 'lang'
- Review key types.
- KEY_RAW_SQL = 'raw_sql'
- KEY_TEXT = 'text'
- KEY_TEXTS = 'texts'
- KEY_WORDS = 'words'
- TYPE_SENTENCE_TO_TERM = 3
- TYPE_TERM_TO_TRANSLATION = 1
- Review types.
- TYPE_TERM_TO_TRANSLATION_WORD = 4
- TYPE_TRANSLATION_TO_TERM = 2
- TYPE_TRANSLATION_TO_TERM_WORD = 5
Properties
- $isTableMode : bool
- $reviewKey : string
- $reviewType : int
- $selection : int|array<string|int, mixed>|string
- $wordMode : bool
Methods
- __construct() : mixed
- Constructor.
- forTableMode() : self
- Create table mode configuration.
- fromLanguage() : self
- Create configuration for reviewing a language.
- fromText() : self
- Create configuration for reviewing a text.
- fromTexts() : self
- Create configuration for reviewing words from specific texts.
- fromWords() : self
- Create configuration for reviewing specific words.
- getBaseType() : int
- Get base review type (1-3, strips word mode offset).
- getSelectionString() : string
- Get selection as string for URL parameters.
- isValid() : bool
- Check if configuration is valid (has a review key).
- toSqlProjection() : string
- Get SQL projection string for this configuration.
- toUrlProperty() : string
- Get URL property string for this configuration.
- clampReviewType() : int
- Clamp review type to valid range.
Constants
KEY_LANG
Review key types.
public
mixed
KEY_LANG
= 'lang'
KEY_RAW_SQL
public
mixed
KEY_RAW_SQL
= 'raw_sql'
KEY_TEXT
public
mixed
KEY_TEXT
= 'text'
KEY_TEXTS
public
mixed
KEY_TEXTS
= 'texts'
KEY_WORDS
public
mixed
KEY_WORDS
= 'words'
TYPE_SENTENCE_TO_TERM
public
mixed
TYPE_SENTENCE_TO_TERM
= 3
TYPE_TERM_TO_TRANSLATION
Review types.
public
mixed
TYPE_TERM_TO_TRANSLATION
= 1
TYPE_TERM_TO_TRANSLATION_WORD
public
mixed
TYPE_TERM_TO_TRANSLATION_WORD
= 4
TYPE_TRANSLATION_TO_TERM
public
mixed
TYPE_TRANSLATION_TO_TERM
= 2
TYPE_TRANSLATION_TO_TERM_WORD
public
mixed
TYPE_TRANSLATION_TO_TERM_WORD
= 5
Properties
$isTableMode
public
bool
$isTableMode
= false
$reviewKey
public
string
$reviewKey
$reviewType
public
int
$reviewType
= 1
$selection
public
int|array<string|int, mixed>|string
$selection
$wordMode
public
bool
$wordMode
= false
Methods
__construct()
Constructor.
public
__construct(string $reviewKey, int|array<string|int, int>|string $selection[, int $reviewType = 1 ][, bool $wordMode = false ][, bool $isTableMode = false ]) : mixed
Parameters
- $reviewKey : string
-
Review key type (lang, text, words, texts, raw_sql)
- $selection : int|array<string|int, int>|string
-
Selection value (ID, array of IDs, or SQL string)
- $reviewType : int = 1
-
Review type (1-5)
- $wordMode : bool = false
-
Whether in word mode (no sentence)
- $isTableMode : bool = false
-
Whether in table review mode
forTableMode()
Create table mode configuration.
public
static forTableMode(string $reviewKey, int|array<string|int, int>|string $selection) : self
Parameters
- $reviewKey : string
-
Review key type
- $selection : int|array<string|int, int>|string
-
Selection value
Return values
selffromLanguage()
Create configuration for reviewing a language.
public
static fromLanguage(int $langId[, int $reviewType = 1 ][, bool $wordMode = false ]) : self
Parameters
- $langId : int
-
Language ID
- $reviewType : int = 1
-
Review type (1-5)
- $wordMode : bool = false
-
Word mode flag
Return values
selffromText()
Create configuration for reviewing a text.
public
static fromText(int $textId[, int $reviewType = 1 ][, bool $wordMode = false ]) : self
Parameters
- $textId : int
-
Text ID
- $reviewType : int = 1
-
Review type (1-5)
- $wordMode : bool = false
-
Word mode flag
Return values
selffromTexts()
Create configuration for reviewing words from specific texts.
public
static fromTexts(array<string|int, int> $textIds[, int $reviewType = 1 ][, bool $wordMode = false ]) : self
Parameters
- $textIds : array<string|int, int>
-
Array of text IDs
- $reviewType : int = 1
-
Review type (1-5)
- $wordMode : bool = false
-
Word mode flag
Return values
selffromWords()
Create configuration for reviewing specific words.
public
static fromWords(array<string|int, int> $wordIds[, int $reviewType = 1 ][, bool $wordMode = false ]) : self
Parameters
- $wordIds : array<string|int, int>
-
Array of word IDs
- $reviewType : int = 1
-
Review type (1-5)
- $wordMode : bool = false
-
Word mode flag
Return values
selfgetBaseType()
Get base review type (1-3, strips word mode offset).
public
getBaseType() : int
Return values
int —Base review type
getSelectionString()
Get selection as string for URL parameters.
public
getSelectionString() : string
Return values
string —Selection as comma-separated string
isValid()
Check if configuration is valid (has a review key).
public
isValid() : bool
Return values
bool —True if valid
toSqlProjection()
Get SQL projection string for this configuration.
public
toSqlProjection() : string
Tags
Return values
string —SQL fragment for FROM/WHERE clause
toUrlProperty()
Get URL property string for this configuration.
public
toUrlProperty() : string
Return values
string —URL property (e.g., "lang=1" or "text=42")
clampReviewType()
Clamp review type to valid range.
private
static clampReviewType(int $reviewType) : int
Parameters
- $reviewType : int
-
Raw review type
Return values
int —Clamped to 1-5