private function hasDBRefFields($value) : bool
    {
        if (! is_array($value) && ! is_object($value)) {
            return false;
        }

        if (is_object($value)) {
            $value = get_object_vars($value);
        }

        foreach ($value as $key => $_) {
            if ($key === '$ref' || $key === '$id' || $key === '$db') {
                return true;
            }
        }

        return false;
    }
private function hasDBRefFields($value) : bool
    {
        if (! is_array($value) && ! is_object($value)) {
            return false;
        }

        if (is_object($value)) {
            $value = get_object_vars($value);
        }

        foreach ($value as $key => $_) {
            if ($key === '$ref' || $key === '$id' || $key === '$db') {
                return true;
            }
        }

        return false;
    }
private function hasDBRefFields ( $ value ) : bool { if ( ! is_array ( $ value ) && ! is_object ( $ value ) ) { return false ; } if ( is_object ( $ value ) ) { $ value = get_object_vars ( $ value ) ; } foreach ( $ value as $ key => $ _ ) { if ( $ key === '$ref' || $ key === '$id' || $ key === '$db' ) { return true ; } } return false ; }
Checks whether the value has DBRef fields.

This method doesn't check if the the value is a complete DBRef object,
although it should return true for a DBRef. Rather, we're checking that
the value has one or more fields for a DBref. In practice, this could be
$elemMatch criteria for matching a DBRef.

@param mixed $value
Checks whether the value has DBRef fields .