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:
@@ -20,7 +20,7 @@ class User implements API
|
||||
|
||||
public function getUserDetails(): \stdClass
|
||||
{
|
||||
$user = $this->adapter->get('user', [], []);
|
||||
$user = $this->adapter->get('user');
|
||||
$body = json_decode($user->getBody());
|
||||
return $body->result;
|
||||
}
|
||||
@@ -37,7 +37,7 @@ class User implements API
|
||||
|
||||
public function updateUserDetails(array $details): \stdClass
|
||||
{
|
||||
$response = $this->adapter->patch('user', [], $details);
|
||||
$response = $this->adapter->patch('user', $details);
|
||||
return json_decode($response->getBody());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user