Use ?? to avoid undefined key warnings

This commit is contained in:
billz
2025-03-02 00:24:57 -08:00
parent 313e2eb06f
commit 02b9e20ce3

View File

@@ -177,15 +177,17 @@ function getDefaultNetOpts($svc,$key)
* @param string $key
* @return object $json
*/
function getProviderValue($id,$key)
function getProviderValue($id, $key)
{
$obj = json_decode(file_get_contents(RASPI_CONFIG_PROVIDERS), true);
if ($obj === null) {
if (!isset($obj['providers']) || !is_array($obj['providers'])) {
return false;
} else {
$id--;
return $obj['providers'][$id][$key];
}
$id--;
if (!isset($obj['providers'][$id]) || !is_array($obj['providers'][$id])) {
return false;
}
return $obj['providers'][$id][$key] ?? false;
}
/* Functions to write ini files */