Files
cloudflare-php/src/Adapter/Adapter.php
Darin Randal cca073c809 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.
2018-04-12 23:11:04 -04:00

77 lines
1.7 KiB
PHP

<?php
/**
* User: junade
* Date: 13/01/2017
* Time: 16:06
*/
namespace Cloudflare\API\Adapter;
use Cloudflare\API\Auth\Auth;
use Psr\Http\Message\ResponseInterface;
/**
* Interface Adapter
* @package Cloudflare\API\Adapter
* Note that the $body fields expect a JSON key value store.
*/
interface Adapter
{
/**
* Adapter constructor.
*
* @param Auth $auth
* @param string $baseURI
*/
public function __construct(Auth $auth, string $baseURI);
/**
* Sends a GET request.
* Per Robustness Principle - not including the ability to send a body with a GET request (though possible in the
* RFCs, it is never useful).
*
* @param string $uri
* @param array $data
* @param array $headers
*
* @return mixed
*/
public function get(string $uri, array $data = [], array $headers = []): ResponseInterface;
/**
* @param string $uri
* @param array $data
* @param array $headers
*
* @return mixed
*/
public function post(string $uri, array $data = [], array $headers = []): ResponseInterface;
/**
* @param string $uri
* @param array $data
* @param array $headers
*
* @return mixed
*/
public function put(string $uri, array $data = [], array $headers = []): ResponseInterface;
/**
* @param string $uri
* @param array $data
* @param array $headers
*
* @return mixed
*/
public function patch(string $uri, array $data = [], array $headers = []): ResponseInterface;
/**
* @param string $uri
* @param array $data
* @param array $headers
*
* @return mixed
*/
public function delete(string $uri, array $data = [], array $headers = []): ResponseInterface;
}