public static function defaults(array $arr = null, array $defaults): array
    {
        if ($arr === null) {
            return $defaults;
        }
        foreach ($defaults as $key => $value) {
            if (!isset($arr[$key])) {
                $arr[$key] = $value;
            }
        }
        return $arr;
    }
public static function defaults(array $arr = null, array $defaults): array
    {
        if ($arr === null) {
            return $defaults;
        }
        foreach ($defaults as $key => $value) {
            if (!isset($arr[$key])) {
                $arr[$key] = $value;
            }
        }
        return $arr;
    }
public static function defaults ( array $ arr = null , array $ defaults ) : array { if ( $ arr === null ) { return $ defaults ; } foreach ( $ defaults as $ key => $ value ) { if ( ! isset ( $ arr [ $ key ] ) ) { $ arr [ $ key ] = $ value ; } } return $ arr ; }
Ensure that all keys in one array exist in another

@param array $arr The array to fill with missing values
@param array $defaults The values to fill $arr with
@return array
Ensure that all keys in one array exist in another