Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3declare(strict_types=1);
4
5/** @license For full copyright and license information, please see the LICENSE.md file. */
6
7namespace App\Core\Translation;
8
9defined('AMMONLY_APP') || exit('Direct script access is forbidden.');
10
11/**
12 * Locale Context Interface.
13 *
14 * Contract for managing active system languages and request locale.
15 *
16 * @package App\Core\Translation
17 */
18interface LocaleContextInterface
19{
20    /**
21     * Gets current active locale code.
22     *
23     * @return string Current locale code (e.g. 'en', 'pl').
24     */
25    public function getLocale(): string;
26
27    /**
28     * Sets current active locale code if valid.
29     *
30     * @param string $locale Locale code to set.
31     */
32    public function setLocale(string $locale): void;
33
34    /**
35     * Checks if a locale code is valid and active in the system.
36     *
37     * @param string $locale Locale code to check.
38     * @return bool True if locale exists and is active.
39     */
40    public function isValidLocale(string $locale): bool;
41
42    /**
43     * Returns list of active system languages indexed by code.
44     *
45     * @return array<string, array<string, mixed>> Active languages map.
46     */
47    public function getActiveLanguages(): array;
48
49    /**
50     * Resets internal languages cache.
51     */
52    public function resetCache(): void;
53}