<?php
namespace Claromentis\Core\Config;

$GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"] ?: array()) + array("_6596b8f6a4969f9a" . "3f6a1b22b90e9331" => base64_decode("c3ByaW50" . "Zg=="), "_44b97fb00c5dc6204a2e8b4" . "6429ce109" => base64_decode("aXNfc3RyaW5nYWJs" . "ZQ=="), "_5a13027a56ff4" . "26a18806baf1e5" . "3ce74" => base64_decode("Q29uZmlnVm" . "FsdWUgJw=="), "_490fedd0c33685bd3a92a23df" . "bdbe38c" => base64_decode("JyBDb25maWdWYWx1ZSB0byBzdHJpbm" . "c="), "_835783a340b626fa250ace4c8" . "d8249f7" => base64_decode("VW5hYmxlIHRvIGNhc3QgJw=" . "="), "_3758af61703edea17ee38" . "fab15f99b56" => base64_decode("JyBjYW5ub3QgYmUgc2V0IHdpdGhvdXQgYW4gaW5zdGFuY2U" . "gb2YgV3JpdGFibGVDb25maWc="));
use RuntimeException;
use UnexpectedValueException;










class ConfigValue
{
    
    
    
    
    private Config $config;
    
    
    
    
    private string $key;
    
    
    
    
    private ?string $pattern;
    
    
    
    
    
    
    
    
    public function __construct(Config $config, string $key, ?string $_84e9b441a0415723346c265202959c32 = null)
    {
        $this->config = $config;
        $this->key = $key;
        $this->setPattern($_84e9b441a0415723346c265202959c32);
    }
    
    
    
    
    
    
    public function getValue()
    {
        return $this->config->get($this->key);
    }
    
    
    
    
    
    
    public function setValue($value)
    {
        if (!$this->config instanceof WritableConfig) {
            throw new RuntimeException($GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_5a13027a56ff426a" . "18806baf1e53ce74"] . $this->key . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_3758af61703edea17ee38fab15f9" . "9b56"]);
        }
        $this->config->set($this->key, $value);
    }
    
    
    
    
    
    
    public function getPattern() : ?string
    {
        return $this->pattern;
    }
    
    
    
    
    
    
    
    
    public function setPattern(?string $_84e9b441a0415723346c265202959c32)
    {
        $this->pattern = $_84e9b441a0415723346c265202959c32;
    }
    
    
    
    
    
    
    public function getProcessedValue() : string
    {
        $value = $this->getValue();
        if (!$GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_44b97fb00c5" . "dc6204a2e8b4" . "6429ce109"]($value)) {
            
            
            throw new UnexpectedValueException($GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_835783a34" . "0b626fa250" . "ace4c8d824" . "9f7"] . $this->key . $GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_490fedd0c33685bd3a92a23dfbdbe3" . "8c"]);
        }
        if ($this->pattern && $value !== null) {
            $value = $GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_6596b8f6a496" . "9f9a3f6a1b22b" . "90e9331"]($this->pattern, $value);
        }
        return (string) $value;
    }
    
    
    
    
    
    
    
    
    
    public function __toString() : string
    {
        return $this->getProcessedValue();
    }
}