protected function _isSelected($key, $selected)
    {
        if ($selected === null) {
            return false;
        }
        $isArray = is_array($selected);
        if (!$isArray) {
            $selected = $selected === false ? '0' : $selected;

            return (string)$key === (string)$selected;
        }
        $strict = !is_numeric($key);

        return in_array((string)$key, $selected, $strict);
    }
protected function _isSelected($key, $selected)
    {
        if ($selected === null) {
            return false;
        }
        $isArray = is_array($selected);
        if (!$isArray) {
            $selected = $selected === false ? '0' : $selected;

            return (string)$key === (string)$selected;
        }
        $strict = !is_numeric($key);

        return in_array((string)$key, $selected, $strict);
    }
protected function _isSelected ( $ key , $ selected ) { if ( $ selected === null ) { return false ; } $ isArray = is_array ( $ selected ) ; if ( ! $ isArray ) { $ selected = $ selected === false ? '0' : $ selected ; return ( string ) $ key === ( string ) $ selected ; } $ strict = ! is_numeric ( $ key ) ; return in_array ( ( string ) $ key , $ selected , $ strict ) ; }
Helper method for deciding what options are selected.

@param string $key The key to test.
@param array|string|null $selected The selected values.
@return bool
Helper method for deciding what options are selected .