GetTextForReading
in package
Use case for retrieving text data for reading interface.
Prepares all necessary data for the text reading view including text content, language settings, TTS configuration, and navigation.
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- Constructor.
- execute() : array<string|int, mixed>|null
- Get text data for reading interface.
- getLanguageIdByName() : int|null
- Get language ID by language name.
- getLanguageSettingsForReading() : array<string|int, mixed>|null
- Get language settings for reading display.
- getLanguageTranslateUris() : array<int, string>
- Get Google Translate URIs for languages.
- getNavigation() : array{previous: int|null, next: int|null}
- Get previous and next text IDs for navigation.
- getTtsVoiceApi() : string
- Get TTS voice API for a language.
Properties
$textRepository
private
TextRepositoryInterface
$textRepository
Methods
__construct()
Constructor.
public
__construct(TextRepositoryInterface $textRepository) : mixed
Parameters
- $textRepository : TextRepositoryInterface
-
Text repository
execute()
Get text data for reading interface.
public
execute(int $textId) : array<string|int, mixed>|null
Parameters
- $textId : int
-
Text ID
Return values
array<string|int, mixed>|null —Text data for reading or null if not found
getLanguageIdByName()
Get language ID by language name.
public
getLanguageIdByName(string $languageName) : int|null
Parameters
- $languageName : string
-
Language name
Return values
int|null —Language ID or null if not found
getLanguageSettingsForReading()
Get language settings for reading display.
public
getLanguageSettingsForReading(int $languageId) : array<string|int, mixed>|null
Parameters
- $languageId : int
-
Language ID
Return values
array<string|int, mixed>|null —Language settings or null if not found
getLanguageTranslateUris()
Get Google Translate URIs for languages.
public
getLanguageTranslateUris() : array<int, string>
Return values
array<int, string> —Map of language ID to translate URI
getNavigation()
Get previous and next text IDs for navigation.
public
getNavigation(int $textId, int $languageId) : array{previous: int|null, next: int|null}
Parameters
- $textId : int
-
Current text ID
- $languageId : int
-
Language ID
Return values
array{previous: int|null, next: int|null}getTtsVoiceApi()
Get TTS voice API for a language.
public
getTtsVoiceApi(int $languageId) : string
Parameters
- $languageId : int
-
Language ID
Return values
string —TTS voice API string or empty