Table of Contents
TranslationLoader
Layer: Core · Source: lib/core/TranslationLoader.php:10 (lines 10–231)
class TranslationLoader
Inheritance
No parent, interface or trait. This is a root type.
Constants (0)
None.
Properties (7)
| Visibility | Type | Name | Default | Line |
|---|---|---|---|---|
private | (untyped) | $cacheDir | 12 | |
private | (untyped) | $cacheEnabled | true | 13 |
private | (untyped) | $cacheTtl | 3600 | 14 |
private | (untyped) | $loaded | [] | 15 |
private | (untyped) | $translationDao | 16 | |
private | (untyped) | $languageDao | 17 | |
private | (untyped) | $initialized | false | 18 |
Methods (17)
| Visibility | Method | Summary | Line |
|---|---|---|---|
| public | __construct() | (undocumented) | 20 |
| private | initializeDao() | (undocumented) | 27 |
| private | ensureCacheDirectory() | (undocumented) | 45 |
| public | load() | (undocumented) | 52 |
| public | get() | (undocumented) | 77 |
| private | loadFromCache() | (undocumented) | 91 |
| private | saveToCache() | (undocumented) | 109 |
| private | loadFromDatabase() | (undocumented) | 127 |
| private | loadDefaultStrings() | (undocumented) | 153 |
| private | getThemeIdentifier() | (undocumented) | 166 |
| private | getCacheFilePath() | (undocumented) | 178 |
| private | isCacheExpired() | (undocumented) | 183 |
| public | invalidate() | (undocumented) | 193 |
| private | interpolate() | (undocumented) | 204 |
| private | getCurrentLocale() | (undocumented) | 213 |
| public | isCacheEnabled() | (undocumented) | 222 |
| public | setCacheEnabled() | (undocumented) | 227 |
__construct()
public function __construct()
lines 20–25 (6)
Takes no parameters.
initializeDao()
private function initializeDao(): void
lines 27–43 (17)
Takes no parameters.
Returns: void
ensureCacheDirectory()
private function ensureCacheDirectory(): void
lines 45–50 (6)
Takes no parameters.
Returns: void
load()
public function load(string $locale): array
lines 52–75 (24)
| Parameter | Type | Default | Description |
|---|---|---|---|
$locale | string | required | none |
Returns: array
get()
public function get(string $key, ?string $locale = null, array $params = []): string
lines 77–89 (13)
| Parameter | Type | Default | Description |
|---|---|---|---|
$key | string | required | none |
$locale | ?string | null | none |
$params | array | [] | none |
Returns: string
loadFromCache()
private function loadFromCache(string $locale): ?array
lines 91–107 (17)
| Parameter | Type | Default | Description |
|---|---|---|---|
$locale | string | required | none |
Returns: ?array
saveToCache()
private function saveToCache(string $locale, array $translations): void
lines 109–125 (17)
| Parameter | Type | Default | Description |
|---|---|---|---|
$locale | string | required | none |
$translations | array | required | none |
Returns: void
loadFromDatabase()
private function loadFromDatabase(string $locale): array
lines 127–151 (25)
| Parameter | Type | Default | Description |
|---|---|---|---|
$locale | string | required | none |
Returns: array
loadDefaultStrings()
private function loadDefaultStrings(string $locale): array
lines 153–164 (12)
| Parameter | Type | Default | Description |
|---|---|---|---|
$locale | string | required | none |
Returns: array
getThemeIdentifier()
private function getThemeIdentifier(): string
lines 166–176 (11)
Takes no parameters.
Returns: string
getCacheFilePath()
private function getCacheFilePath(string $locale): string
lines 178–181 (4)
| Parameter | Type | Default | Description |
|---|---|---|---|
$locale | string | required | none |
Returns: string
isCacheExpired()
private function isCacheExpired(string $cacheFile): bool
lines 183–191 (9)
| Parameter | Type | Default | Description |
|---|---|---|---|
$cacheFile | string | required | none |
Returns: bool
invalidate()
public function invalidate(string $locale): void
lines 193–202 (10)
| Parameter | Type | Default | Description |
|---|---|---|---|
$locale | string | required | none |
Returns: void
interpolate()
private function interpolate(string $text, array $params): string
lines 204–211 (8)
| Parameter | Type | Default | Description |
|---|---|---|---|
$text | string | required | none |
$params | array | required | none |
Returns: string
getCurrentLocale()
private function getCurrentLocale(): string
lines 213–220 (8)
Takes no parameters.
Returns: string
isCacheEnabled()
public function isCacheEnabled(): bool
lines 222–225 (4)
Takes no parameters.
Returns: bool
setCacheEnabled()
public function setCacheEnabled(bool $enabled): void
lines 227–230 (4)
| Parameter | Type | Default | Description |
|---|---|---|---|
$enabled | bool | required | none |
Returns: void
Imports
| Alias | Fully-qualified name |
|---|---|
LanguageDao | ''Scriptlog\Dao\LanguageDao'' |
TranslationDao | ''Scriptlog\Dao\TranslationDao'' |
This page is generated from source by 'tools/gendoc'. Edits will be overwritten.
