On 18 February 2024 15:26:37 GMT, Lynn <kja...@gmail.com> wrote:
> Having a lot of setters for options might make it really hard to find the
>methods you're looking for in terms of auto-complete in your IDE. 


I think it would be significantly better for that purpose than what we have 
now, because there would be a lot fewer methods than there are current option 
constants. 

Firstly, because most of the methods would cover multiple overlapping or 
related options - e.g. setHttpMethod(string $method) covers CURLOPT_POST, 
CURLOPT_PUT, CURLOPT_CUSTOMREQUEST, and CURLOPT_HTTPGET; 
setBasicAuth($username, $password) combines CURLOPT_HTTPAUTH, CURLOPT_USERNAME, 
and CURLOPT_PASSWORD.

Secondly, because some functionality that's not used as often can just be left 
to the curl_setopt equivalents forever, e.g. we don't need new methods for 
CURLOPT_DNS_SHUFFLE_ADDRESSES, CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS, etc, etc.

The initial aim could be to cover, say, the 10 most commonly used settings - 
things like choosing the request method, and including custom request headers. 
Over time, we could add more methods for common tasks, but continue adding 
constants / enum cases for more obscure features of the library.


> Would it
>make sense to split options into a separate object (or perhaps multiple),
>that could in theory also be shared between different CurlHandle instances?

While I'm not against splitting things up into more objects, I think that 
becomes a much bigger task to define what goes in each, and harder to do 
half-way. My gut feeling is that it would descend into a lot of bikeshedding, 
and stop us making progress; whereas adding a few methods for common use cases 
could present a real quick win.


Regards,

-- 
Rowan Tommins
[IMSoP]

Reply via email to