diff --git a/index.php b/index.php index 83f87e14..ef062bfa 100644 --- a/index.php +++ b/index.php @@ -37,10 +37,8 @@ spl_autoload_register( * Config */ $configPath = __DIR__ . '/' . 'src/config/config.php'; - -if (file_exists($configPath)) { - require $configPath; -} +$config = new Config($configPath); +$config->load(); /** * Session diff --git a/src/classes/wishthis/Config.php b/src/classes/wishthis/Config.php new file mode 100644 index 00000000..9b61a5b6 --- /dev/null +++ b/src/classes/wishthis/Config.php @@ -0,0 +1,26 @@ +filePath); + } + + public function load(): bool + { + $exists = $this->exists(); + + if ($exists) { + require $this->filePath; + } + + return $exists; + } +}