<commit_before><?php

namespace App\Config;


class App
{

    private $db_settings = [];
    private $app_settings = [];
    private static $_instance;


    public static function getInstance()
    {
        if (is_null(self::$_instance)) {
            self::$_instance = new App();
        }
        return self::$_instance;
    }

    private function __construct()
    {
        $this->db_settings = require(BASE . DS . 'App' . DS . 'Config' . DS . 'database.php');
        $this->app_settings = require(BASE . DS . 'App' . DS . 'Config' . DS . 'app_config.php');
    }

    public function getDbSettings($key)
    {
        if (!isset($this->db_settings[$key])) {
            return null;
        }
        return $this->db_settings[$key];
    }

    public function getAppSettings($key)
    {
        if (!isset($this->app_settings[$key])) {
            return null;
        }
        return $this->app_settings[$key];
    }


} <commit_msg>add gestion de l'env<commit_after><?php

namespace App\Config;


class App
{

    private $db_settings = [];
    private $app_settings = [];
    private static $_instance;


    public static function getInstance()
    {
        if (is_null(self::$_instance)) {
            self::$_instance = new App();
        }
        return self::$_instance;
    }

    private function __construct()
    {
        // Récupération des des paramettres
        $this->db_settings = require(BASE . DS . 'App' . DS . 'Config' . DS . 'database.php');
        $this->app_settings = require(BASE . DS . 'App' . DS . 'Config' . DS . 'app_config.php');

        // Chargement de l'envrionnement
        $env = $this->app_settings['environments_ip'][$_SERVER['REMOTE_ADDR']];
        if (!file_exists('../Config/' . $env . '.env'))
            die('Le fichier de configuration de l‘environnement <code>' . $env . '.env</code> est introuvable !');

        (new \josegonzalez\Dotenv\Loader('../Config/' . $env . '.env'))->parse()->toEnv();
    }

    public function getDbSettings($key)
    {
        if (!isset($this->db_settings[$key])) {
            return null;
        }
        return $this->db_settings[$key];
    }

    public function getAppSettings($key)
    {
        if (!isset($this->app_settings[$key])) {
            return null;
        }
        return $this->app_settings[$key];
    }


} 
{'fraction_non_alphanumeric': 0.15780445969125215, 'fraction_numerical': 0.0, 'mean_word_length': 2.1273458445040214, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1410797', 'n_tokens_mistral': 724, 'n_tokens_neox': 703, 'n_words': 151}