ListLanguages
in package
Use case for listing languages with various formats and statistics.
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- getAllLanguages() : array<string, int>
- Get all languages as a name => id dictionary.
- getLanguagesForSelect() : array<int, array{id: int, name: string}>
- Get languages formatted for select dropdown options.
- getLanguagesWithArchivedTextCounts() : array<int, array{id: int, name: string, text_count: int}>
- Get languages that have at least one archived text, with archived text counts.
- getLanguagesWithStats() : array<string|int, mixed>
- Get languages with statistics for display.
- getLanguagesWithTextCounts() : array<int, array{id: int, name: string, text_count: int}>
- Get languages that have at least one text, with text counts.
- getRelatedDataCounts() : array{texts: int, archivedTexts: int, words: int, feeds: int}
- Get counts of related data for a language.
- getArticleCounts() : array<int, int>
- Get article counts per language.
- getFeedCounts() : array<int, int>
- Get feed counts per language.
Properties
$repository
private
LanguageRepositoryInterface
$repository
Methods
__construct()
public
__construct([LanguageRepositoryInterface|null $repository = null ]) : mixed
Parameters
- $repository : LanguageRepositoryInterface|null = null
-
Repository instance
getAllLanguages()
Get all languages as a name => id dictionary.
public
getAllLanguages() : array<string, int>
Return values
array<string, int>getLanguagesForSelect()
Get languages formatted for select dropdown options.
public
getLanguagesForSelect([int $maxNameLength = 30 ]) : array<int, array{id: int, name: string}>
Parameters
- $maxNameLength : int = 30
-
Maximum name length before truncation
Return values
array<int, array{id: int, name: string}>getLanguagesWithArchivedTextCounts()
Get languages that have at least one archived text, with archived text counts.
public
getLanguagesWithArchivedTextCounts() : array<int, array{id: int, name: string, text_count: int}>
Return values
array<int, array{id: int, name: string, text_count: int}>getLanguagesWithStats()
Get languages with statistics for display.
public
getLanguagesWithStats() : array<string|int, mixed>
Return values
array<string|int, mixed> —Language data with counts
getLanguagesWithTextCounts()
Get languages that have at least one text, with text counts.
public
getLanguagesWithTextCounts() : array<int, array{id: int, name: string, text_count: int}>
Return values
array<int, array{id: int, name: string, text_count: int}>getRelatedDataCounts()
Get counts of related data for a language.
public
getRelatedDataCounts(int $lid) : array{texts: int, archivedTexts: int, words: int, feeds: int}
Parameters
- $lid : int
-
Language ID
Return values
array{texts: int, archivedTexts: int, words: int, feeds: int}getArticleCounts()
Get article counts per language.
private
getArticleCounts() : array<int, int>
Return values
array<int, int> —Language ID => article count
getFeedCounts()
Get feed counts per language.
private
getFeedCounts() : array<int, int>
Return values
array<int, int> —Language ID => feed count