<?php
namespace Claromentis\Core\Localization;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"] ?: array()) + array("_53d43bf1f489" . "59b27c566cc3f" . "5b06681" => base64_decode("UGhyYXNl" . "ICc="), "_7d9ddc77b5329ea4" . "78ce5d43e4615f53" => base64_decode("JyBkb2Vzbid0IGV4aX" . "N0"));
use Claromentis\Core\Localization\Exception\MissingPhraseException;








class MemoryProvider implements LocalizationProviderInterface
{
    
    
    
    
    protected $files_reader;
    
    
    
    
    protected $app_code;
    
    
    
    
    protected $lm = array();
    
    
    
    
    protected $lt_parsed = array();
    
    
    
    
    
    
    
    public function __construct($_d901b83ea3a884001dad5ede20f9b05e, Files $_00f2055c7cbd408ef56949f35c62b721)
    {
        $this->app_code = $_d901b83ea3a884001dad5ede20f9b05e;
        $this->files_reader = $_00f2055c7cbd408ef56949f35c62b721;
    }
    
    
    public function getTranslation(string $key, string $language)
    {
        $this->CheckLoadMessages($language);
        if (!isset($this->lm[$language][$key])) {
            throw new MissingPhraseException($GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_53d43bf1f4895" . "9b27c566cc3f5b" . "06681"] . $key . $GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_7d9ddc77b5329ea478ce5d43e4615" . "f53"]);
        }
        return $this->lm[$language][$key];
    }
    
    
    public function getTemplaterPhrases(string $language) : array
    {
        $this->CheckLoadTemplaterMessages($language);
        return $this->lt_parsed[$language];
    }
    
    
    
    
    
    
    public function CheckLoadMessages($language)
    {
        if (isset($this->lm[$language])) {
            return;
        }
        $this->lm[$language] = [];
        $this->files_reader->ReadLM($this->lm[$language], $this->app_code, $language);
    }
    
    
    
    
    
    
    protected function CheckLoadTemplaterMessages($language)
    {
        if (isset($this->lt_parsed[$language])) {
            return;
        }
        $this->lt_parsed[$language] = array();
        $this->CheckLoadMessages($language);
        $this->files_reader->ReadLT($this->lm[$language], $this->lt_parsed[$language], $this->app_code, $language);
    }
    
    
    public function hasKey(string $key, string $language) : bool
    {
        $this->CheckLoadMessages($language);
        return isset($this->lm[$language][$key]);
    }
    
    
    
    
    public function getDomain() : string
    {
        return (string) $this->app_code;
    }
    
    
    
    
    
    
    
    public function getDataHash(string $language) : ?string
    {
        return $this->files_reader->GetDataHash($this->app_code, $language);
    }
}