public function chooseResponse(array $types)
    {
        if (empty($types))
            return null;

        $this->sortTypes($types);
        $first = reset($types);
        $type = key($types);

        return $this->accepts($type) ? $first : null;
    }