Skip to content

Commit

Permalink
Update Config.php
Browse files Browse the repository at this point in the history
  • Loading branch information
juancristobalgd1 authored Aug 4, 2024
1 parent 4627cc3 commit 5a7d9a0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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));
}
Expand Down

0 comments on commit 5a7d9a0

Please sign in to comment.