Code cleanup / Quality of Life updates

Adapter::get, post, put, patch and delete all had non-optional parameters for $headers and $query or $body. These have been made optional. I also re-ordered the parameters as $headers was never used while $query/$body were heavily used. I also condensed and removed some duplicate calls so that every call to Adapter::get/post sends that call to Adapter::request. It could use a magic method to do this but it might make it more difficult to test.
This commit is contained in:
Darin Randal
2018-04-12 23:11:04 -04:00
parent 35ce8eadf1
commit cca073c809
31 changed files with 169 additions and 263 deletions

View File

@@ -31,46 +31,46 @@ interface Adapter
* RFCs, it is never useful).
*
* @param string $uri
* @param array $query
* @param array $data
* @param array $headers
*
* @return mixed
*/
public function get(string $uri, array $query, array $headers): ResponseInterface;
public function get(string $uri, array $data = [], array $headers = []): ResponseInterface;
/**
* @param string $uri
* @param array $data
* @param array $headers
* @param array $body
*
* @return mixed
*/
public function post(string $uri, array $headers, array $body): ResponseInterface;
public function post(string $uri, array $data = [], array $headers = []): ResponseInterface;
/**
* @param string $uri
* @param array $data
* @param array $headers
* @param array $body
*
* @return mixed
*/
public function put(string $uri, array $headers, array $body): ResponseInterface;
public function put(string $uri, array $data = [], array $headers = []): ResponseInterface;
/**
* @param string $uri
* @param array $data
* @param array $headers
* @param array $body
*
* @return mixed
*/
public function patch(string $uri, array $headers, array $body): ResponseInterface;
public function patch(string $uri, array $data = [], array $headers = []): ResponseInterface;
/**
* @param string $uri
* @param array $data
* @param array $headers
* @param array $body
*
* @return mixed
*/
public function delete(string $uri, array $headers, array $body): ResponseInterface;
public function delete(string $uri, array $data = [], array $headers = []): ResponseInterface;
}