public function isSelectedValue($dataValue, $userValue)
    {
        if ($dataValue === $userValue) {
            return true;
        }

        // Allow null to match empty strings
        if ($dataValue === '' && $userValue === null) {
            return true;
        }

        // Safety check against casting arrays as strings in PHP>5.4
        if (is_array($dataValue) || is_array($userValue)) {
            return false;
        }

        // For non-falsey values do loose comparison
        if ($dataValue) {
            return $dataValue == $userValue;
        }

        // For empty values, use string comparison to perform visible value match
        return ((string) $dataValue) === ((string) $userValue);
    }