php-mod / curl

This library provides an object-oriented and dependency free wrapper of the PHP cURL extension.
MIT License
328 stars 120 forks source link

Getters for response, status code and others #58

Closed jormaechea closed 5 years ago

jormaechea commented 5 years ago

It would be nice to have some more getters, so I don't depend on the object properties, and also mock this lib properly in my projects. For tests, it's cleaner to mock methods than just setting the $curl->response property, for example.

The following getters would be appreciated:

public function getResponse(); // Returns response prop

public function getErrorCode(); // Returns curl_error_code prop

public function getErrorMessage(); // Returns curl_error_message prop

public function getHttpStatus(); // Returns http_status_code prop

Of course I could build a wrapper for this, but then I'd have two dependencies for something as simple as making a request.

amouhzi commented 5 years ago

Fixed https://github.com/php-mod/curl/pull/59