Skip to content
This repository has been archived by the owner on Nov 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #74 from aaronhuisinga/master
Browse files Browse the repository at this point in the history
Update default data parameters for request methods
  • Loading branch information
jamesryanbell authored Aug 4, 2017
2 parents 6975ca6 + b1709bc commit 75e93bb
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions src/CloudFlare/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,64 +92,64 @@ public function setCurlOption($key, $value)
/**
* API call method for sending requests using GET
*
* @param string $path Path of the endpoint
* @param array|null $data Data to be sent along with the request
* @param string $path Path of the endpoint
* @param array $data Data to be sent along with the request
*
* @return mixed
*/
public function get($path, array $data = null)
public function get($path, array $data = [])
{
return $this->request($path, $data, 'get');
}

/**
* API call method for sending requests using POST
*
* @param string $path Path of the endpoint
* @param array|null $data Data to be sent along with the request
* @param string $path Path of the endpoint
* @param array $data Data to be sent along with the request
*
* @return mixed
*/
public function post($path, array $data = null)
public function post($path, array $data = [])
{
return $this->request($path, $data, 'post');
}

/**
* API call method for sending requests using PUT
*
* @param string $path Path of the endpoint
* @param array|null $data Data to be sent along with the request
* @param string $path Path of the endpoint
* @param array $data Data to be sent along with the request
*
* @return mixed
*/
public function put($path, array $data = null)
public function put($path, array $data = [])
{
return $this->request($path, $data, 'put');
}

/**
* API call method for sending requests using DELETE
*
* @param string $path Path of the endpoint
* @param array|null $data Data to be sent along with the request
* @param string $path Path of the endpoint
* @param array $data Data to be sent along with the request
*
* @return mixed
*/
public function delete($path, array $data = null)
public function delete($path, array $data = [])
{
return $this->request($path, $data, 'delete');
}

/**
* API call method for sending requests using PATCH
*
* @param string $path Path of the endpoint
* @param array|null $data Data to be sent along with the request
* @param string $path Path of the endpoint
* @param array $data Data to be sent along with the request
*
* @return mixed
*/
public function patch($path, array $data = null)
public function patch($path, array $data = [])
{
return $this->request($path, $data, 'patch');
}
Expand All @@ -159,13 +159,13 @@ public function patch($path, array $data = null)
*
* API call method for sending requests using GET, POST, PUT, DELETE OR PATCH
*
* @param string $path Path of the endpoint
* @param array|null $data Data to be sent along with the request
* @param string|null $method Type of method that should be used ('GET', 'POST', 'PUT', 'DELETE', 'PATCH')
* @param string $path Path of the endpoint
* @param array $data Data to be sent along with the request
* @param string $method Type of method that should be used ('GET', 'POST', 'PUT', 'DELETE', 'PATCH')
*
* @return mixed
*/
protected function request($path, array $data = array(), $method = 'get')
protected function request($path, array $data = [], $method = 'get')
{
if (!isset($this->email, $this->auth_key) || false === filter_var($this->email, FILTER_VALIDATE_EMAIL)) {
throw new AuthenticationException('Authentication information must be provided');
Expand Down Expand Up @@ -194,8 +194,8 @@ protected function request($path, array $data = array(), $method = 'get')

$user_agent = __FILE__;
$headers = [
"X-Auth-Email: {$this->email}",
"X-Auth-Key: {$this->auth_key}",
"X-Auth-Email: {$this->email}",
"X-Auth-Key: {$this->auth_key}",
"User-Agent: {$user_agent}",
'Content-type: application/json',
];
Expand Down

0 comments on commit 75e93bb

Please sign in to comment.