Documentation

ReviewConfiguration
in package

Read onlyYes
FinalYes

Value object representing review configuration parameters.

Immutable after creation. Encapsulates review type, selection mode, and other review parameters.

Tags
since
3.0.0

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
$rawParams  : array<string|int, mixed>
$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).
toSqlProjectionPrepared()  : string
Get SQL projection string with prepared statement placeholders.
toUrlProperty()  : string
Get URL property string for this configuration.
clampReviewType()  : int
Clamp review type to valid range.
langPrepared()  : string
Build prepared SQL for language selection.
rawSqlPrepared()  : string
Build prepared SQL for raw SQL selection.
textPrepared()  : string
Build prepared SQL for text selection.
textsPrepared()  : string
Build prepared SQL for text ID list selection.
wordsPrepared()  : string
Build prepared SQL for word ID list selection.

Constants

Properties

Methods

__construct()

Constructor.

public __construct(string $reviewKey, int|array<string|int, int>|string $selection[, int $reviewType = 1 ][, bool $wordMode = false ][, bool $isTableMode = false ][, array<int, int|string> $rawParams = [] ]) : 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

$rawParams : array<int, int|string> = []

Pre-bound parameters for KEY_RAW_SQL

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
self

fromLanguage()

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
self

fromText()

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
self

fromTexts()

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
self

fromWords()

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
self

getBaseType()

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

toSqlProjectionPrepared()

Get SQL projection string with prepared statement placeholders.

public toSqlProjectionPrepared(array<int, int|string> &$params) : string

Returns SQL with ? placeholders and pushes bound values into $params.

Parameters
$params : array<int, int|string>

Reference to params array for binding

Tags
throws
InvalidArgumentException

If review key is invalid

Return values
string

SQL fragment for FROM/WHERE clause with ? placeholders

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

langPrepared()

Build prepared SQL for language selection.

private langPrepared(array<int, int|string> &$params) : string
Parameters
$params : array<int, int|string>

Reference to params array

Return values
string

SQL fragment

rawSqlPrepared()

Build prepared SQL for raw SQL selection.

private rawSqlPrepared(array<int, int|string> &$params) : string
Parameters
$params : array<int, int|string>

Reference to params array

Return values
string

SQL fragment

textPrepared()

Build prepared SQL for text selection.

private textPrepared(array<int, int|string> &$params) : string
Parameters
$params : array<int, int|string>

Reference to params array

Return values
string

SQL fragment

textsPrepared()

Build prepared SQL for text ID list selection.

private textsPrepared(array<int, int|string> &$params) : string
Parameters
$params : array<int, int|string>

Reference to params array

Return values
string

SQL fragment

wordsPrepared()

Build prepared SQL for word ID list selection.

private wordsPrepared(array<int, int|string> &$params) : string
Parameters
$params : array<int, int|string>

Reference to params array

Return values
string

SQL fragment


        
On this page

Search results