<?php
namespace Claromentis\Core\Config;

$GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"] = (@$GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"] ?: array()) + array("_8a36a84baeffc0085672f9bf9" . "c064f67" => base64_decode("ZmlsZV9wdXRfY29udGVu" . "dHM="), "_8ff0e2c6dc53989c37139dd673c9ef" . "80" => base64_decode("X" . "A" . "=" . "="), "_e92ad742fc12ec1dd5c30" . "557fafca331" => base64_decode("Ig" . "=="), "_85b1d6168626327" . "100decb1627215bb" . "d" => base64_decode("aXNfd3JpdG" . "FibGU="), "_3ce655ae4a1442196" . "7cc023a6e907ed5" => base64_decode("aXNf" . "Zmls" . "ZQ=="), "_d706c160e4" . "5bf7434fff8" . "2a5976f0e19" => base64_decode("YXJyYXlfa2V" . "5cw=="), "_4d707fab93bebb00bbe6" . "9e8159697c90" => base64_decode(""), "_79a71f554e3d3d9549bf78" . "bcfea3f6be" => base64_decode("XC" . "I="), "_eaffc5d7e0ea1c84c" . "4b39f95d2e2fc8d" => base64_decode("c3RyX3JlcGxh" . "Y2U="), "_bd71c3b5c" . "201fc11db8" . "2ed14ce424" . "de5" => base64_decode("aW5f" . "YXJy" . "YXk="), "_644b798b19dd133ec9211fb916df0" . "32b" => base64_decode("ZmlsZV9nZXRfY29" . "udGVudHM="), "_bb152d3d0f3a7af77c042dab18" . "4b9545" => base64_decode("PQ" . "=="), "_d43b05b" . "9d2a6bb8" . "4e6bf44f" . "3416d342" . "1" => base64_decode("X" . "F" . "w" . "="), "_9a2152b0718b64ebb25ca4d5dc67e4" . "c7" => base64_decode("RW52aXJvbm1lbnQgY29uZmlndXJhdGlvbiB3cml0dGVuIHRv" . "IC5lbnYgZmlsZQ=="));
use Claromentis\Core\Config\Exception\DotenvException;
use Dotenv\Dotenv;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use Psr\Log\NullLogger;







class ConfigDotenv implements WritableConfig, LoggerAwareInterface
{
    use LoggerAwareTrait;
    
    
    
    
    protected Environment $environment;
    
    
    
    
    protected array $values = [];
    
    
    
    
    protected Dotenv $dotenv;
    
    
    
    
    protected string $filePath;
    public function __construct(Environment $_6e2e5d4222c95a8fef1631a7dff02f97, Dotenv $_f08e7b69505d3f1bdcd71b2b20adb653, string $_99439ccceff810d579843bc36b914bef)
    {
        $this->environment = $_6e2e5d4222c95a8fef1631a7dff02f97;
        $this->dotenv = $_f08e7b69505d3f1bdcd71b2b20adb653;
        $this->filePath = $_99439ccceff810d579843bc36b914bef;
        $this->values = $_f08e7b69505d3f1bdcd71b2b20adb653->safeLoad();
        $this->logger = new NullLogger();
    }
    public function has(string $key) : bool
    {
        return $this->environment->has($key);
    }
    public function get(string $key)
    {
        return $this->environment->get($key);
    }
    public function getAll() : array
    {
        return $this->environment->getAll();
    }
    public function set(string $key, $value) : void
    {
        if (!$this->canSet($key)) {
            return;
        }
        $this->values[$key] = $value;
    }
    public function setMany(array $values) : void
    {
        foreach ($values as $key => $value) {
            $this->set($key, $value);
        }
    }
    public function delete(string $key) : void
    {
        unset($this->values[$key]);
    }
    public function save() : void
    {
        
        
        $this->writeDotenv($this->values, $this->filePath);
        $this->logger->notice($GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_9a2152b0718b64ebb25" . "ca4d5dc67e4c7"], [$this->values]);
        
        
        $this->values = $this->dotenv->safeLoad();
        $this->environment->loadFromGlobals();
    }
    public function canSet(string $key) : bool
    {
        return $GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_bd71c3b5c201fc11db8" . "2ed14ce424de5"]($key, $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_d706c160e45b" . "f7434fff82a59" . "76f0e19"]($this->environment::ALIASES));
    }
    
    
    
    
    
    
    
    
    private function writeDotenv(array $values, string $_99439ccceff810d579843bc36b914bef) : void
    {
        $_d34599daeb8cca374d3adb38b245839c = $this->buildDotenvContentString($values);
        if ($GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_3ce655ae4a1" . "4421967cc023" . "a6e907ed5"]($_99439ccceff810d579843bc36b914bef) && !$GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_85b1d6168626327100decb1627215b" . "bd"]($_99439ccceff810d579843bc36b914bef)) {
            throw DotenvException::fileNotWritable($_99439ccceff810d579843bc36b914bef);
        }
        $GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_8a36a84baeffc0085672f9bf9c0" . "64f67"]($_99439ccceff810d579843bc36b914bef, $_d34599daeb8cca374d3adb38b245839c);
        if (!$GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_3ce655ae4a14421967" . "cc023a6e907ed5"]($_99439ccceff810d579843bc36b914bef) || $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_644b798b19dd13" . "3ec9211fb916df0" . "32b"]($_99439ccceff810d579843bc36b914bef) !== $_d34599daeb8cca374d3adb38b245839c) {
            throw DotenvException::fileWriteFailed($_99439ccceff810d579843bc36b914bef);
        }
    }
    
    
    
    
    
    
    
    
    private function buildDotenvContentString(array $_d34599daeb8cca374d3adb38b245839c) : string
    {
        $_4a761700523546d260b49b42b6c9fdb6 = $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_4d707fab93bebb00bbe69e" . "8159697c90"];
        foreach ($_d34599daeb8cca374d3adb38b245839c as $key => $value) {
            
            
            $value = $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_eaffc5d7e" . "0ea1c84c4b" . "39f95d2e2f" . "c8d"]($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_8ff0e2c6dc53989c37139dd673c9ef" . "80"], $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_d43b05b9d2a6bb8" . "4e6bf44f3416d342" . "1"], $value);
            $value = $GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_eaffc5d7e0ea1c84c4" . "b39f95d2e2fc8d"]($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_e92ad74" . "2fc12ec1" . "dd5c3055" . "7fafca33" . "1"], $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_79a71f554e3d3d9549bf78" . "bcfea3f6be"], $value);
            $value = $GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_e92ad742fc12ec1dd5c30557f" . "afca331"] . $value . $GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_e92ad742fc12e" . "c1dd5c30557faf" . "ca331"];
            $_4a761700523546d260b49b42b6c9fdb6 .= $key . $GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_bb152d3d0f3" . "a7af77c042da" . "b184b9545"] . $value . PHP_EOL;
        }
        return $_4a761700523546d260b49b42b6c9fdb6;
    }
    public function offsetExists($_1f50e30be8c2fefa6881834e71d504a2) : bool
    {
        return $this->has($_1f50e30be8c2fefa6881834e71d504a2);
    }
    public function offsetGet($_1f50e30be8c2fefa6881834e71d504a2)
    {
        return $this->get($_1f50e30be8c2fefa6881834e71d504a2);
    }
    public function offsetSet($_1f50e30be8c2fefa6881834e71d504a2, $value) : void
    {
        $this->set($_1f50e30be8c2fefa6881834e71d504a2, $value);
    }
    public function offsetUnset($_1f50e30be8c2fefa6881834e71d504a2) : void
    {
        $this->delete($_1f50e30be8c2fefa6881834e71d504a2);
    }
}