diff --git a/src/Config.php b/src/Config.php index 2fcb95c..a287bb4 100644 --- a/src/Config.php +++ b/src/Config.php @@ -67,9 +67,8 @@ public static function set(string $var, $value): void */ public function read(string $file, string $path = null, bool $force = false): array { - if ($force) { + if ($force) return self::$config[$file] = self::load($file, $path); - } return self::$config[$file] ??= self::load($file, $path); } @@ -80,9 +79,8 @@ public function read(string $file, string $path = null, bool $force = false): ar public static function load(string $name, string $path = null): array { $path = $path ?? self::DEFAULT_DIR; - if (is_file($fileConfig = $path . $name . '.php')) { + if (is_file($fileConfig = $path . $name . '.php')) return require $fileConfig; - } throw new \Exception(sprintf('Error when opening the configuration file [ %s ] ', $fileConfig)); }