<?php
declare (strict_types = 1);
namespace ProxyPay\Core;

class Config
{
	private $data = [];

	private static $instance;

	private function __construct()
	{
		$configName = __DIR__.'/../../.env';

		if (!file_exists($configName)) {
			throw new \Exception("file {$configName} didnt exist ");
		}
		$this->data = parse_ini_file($configName);
	}

	static public function get()
	{
		if (self::$instance){
			return self::$instance;
		}

		self::$instance = new self();
		return self::$instance;
	}

	public function __get($name)
	{
		return $this->data[$name] ?? false;
	}

}
