Skip to content

Commit

Permalink
fixes some code
Browse files Browse the repository at this point in the history
  • Loading branch information
nahid committed Jul 28, 2020
1 parent 64d3cf4 commit f95901d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions Examples/Basic HTTP Example/BasicHTTPAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ public function getAllUsers()

public function createUser(array $data)
{
return $this->json($data)->post('users');
return $this->withJson($data)->post('users');
}

public function updateUser(array $data)
{
return $this->json($data)->put('users');
return $this->withJson($data)->put('users');
}

public function partiallyUpdateUser(array $data)
{
return $this->json($data)->patch('users');
return $this->withJson($data)->patch('users');
}

public function deleteUser($id)
Expand Down
6 changes: 3 additions & 3 deletions Tests/Feature/Mocks/BasicHTTPAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ public function getAllUsers()

public function createUser(array $data)
{
return $this->json($data)->post('users');
return $this->withJson($data)->post('users');
}

public function updateUser(array $data)
{
return $this->json($data)->put('users');
return $this->withJson($data)->put('users');
}

public function partiallyUpdateUser(array $data)
{
return $this->json($data)->patch('users');
return $this->withJson($data)->patch('users');
}

public function deleteUser($id)
Expand Down
8 changes: 4 additions & 4 deletions src/AbstractApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Apiz;

use Apiz\Http\AbstractClient;
use Apiz\Http\Clients\AbstractClient;
use Apiz\Http\Clients\GuzzleClient;
use Apiz\Http\Request;
use Apiz\Http\Response;
Expand Down Expand Up @@ -250,7 +250,7 @@ protected function basicAuth($username, $password, array $opts = [])
* @param string|array $contents
* @return AbstractApi|bool
*/
protected function body($contents)
protected function withBody($contents)
{
if (is_array($contents)) {
$this->withHeaders([
Expand All @@ -271,7 +271,7 @@ protected function body($contents)
* @param array $params
* @return AbstractApi|bool
*/
protected function json(array $params = [])
protected function withJson(array $params = [])
{
$this->request->setParameters($params, 'json');

Expand All @@ -287,7 +287,7 @@ protected function json(array $params = [])
* @param array $headers
* @return AbstractApi
*/
protected function file($name, $file, $filename, array $headers = [])
protected function withFile($name, $file, $filename, array $headers = [])
{
if (file_exists($file)) {
$contents = fopen($file, 'r');
Expand Down

0 comments on commit f95901d

Please sign in to comment.