diff --git a/app/Config.php b/app/Config.php index 69d7d66..37d5576 100644 --- a/app/Config.php +++ b/app/Config.php @@ -8,7 +8,6 @@ namespace Sakura; use Sakura\Exceptions\ConfigNonExistentException; use Sakura\Exceptions\ConfigParseException; -use Sakura\Exceptions\ConfigValueNotFoundException; /** * Handles the configuration settings of Sakura. @@ -50,7 +49,6 @@ class Config * Get a value from the configuration. * @param string $section * @param string $key - * @throws ConfigValueNotFoundException * @return array|string */ public static function get(string $section, string $key = null) @@ -66,6 +64,6 @@ class Config return self::$config[$section]; } - throw new ConfigValueNotFoundException; + return null; } } diff --git a/app/Exceptions/ConfigValueNotFoundException.php b/app/Exceptions/ConfigValueNotFoundException.php deleted file mode 100644 index d982089..0000000 --- a/app/Exceptions/ConfigValueNotFoundException.php +++ /dev/null @@ -1,16 +0,0 @@ - - */ -class ConfigValueNotFoundException extends BaseException -{ -} diff --git a/utility.php b/utility.php index f57d697..9f92db6 100644 --- a/utility.php +++ b/utility.php @@ -4,7 +4,6 @@ */ use Sakura\Config; -use Sakura\Exceptions\ConfigValueNotFoundException; use Sakura\FileSystem; use Sakura\Net; use Sakura\Router; @@ -17,15 +16,7 @@ function config($value) $key = array_pop($split); $section = implode('.', $split); - try { - return Config::get($section, $key); - } catch (ConfigValueNotFoundException $e) { - try { - return Config::get($value); - } catch (ConfigValueNotFoundException $e) { - return null; - } - } + return Config::get($section, $key) ?? Config::get($value) ?? null; } // Alias for Router::route