Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Changed keywords to lowercase, to match PSR-2.
  • Loading branch information
Adam Meech committed Feb 9, 2015
commit 7a38b2e75b24561fbf5464848b1a5830744ef04d
18 changes: 9 additions & 9 deletions src/Wheniwork.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ class Wheniwork
private $api_token;
private $api_endpoint = 'https://api.wheniwork.com/2';
private $api_headers = [];
private $verify_ssl = FALSE;
private $verify_ssl = false;

/**
* Create a new instance
*
* @param string $api_token The user WhenIWork API token
* @param array $options Allows you to set the `headers` and the `endpoint`
*/
function __construct($api_token = NULL, $options = [])
function __construct($api_token = null, $options = [])
{
$this->api_token = $api_token;

if (!empty($options['endpoint'])) {
$this->setEndpoint($options['endpoint']);
}
if (!empty($options['headers'])) {
$this->setHeaders($options['headers'], TRUE);
$this->setHeaders($options['headers'], true);
}
}

Expand Down Expand Up @@ -104,9 +104,9 @@ public function getEndpoint()
* @param bool $reset
* @return $this
*/
public function setHeaders(array $headers, $reset = FALSE)
public function setHeaders(array $headers, $reset = false)
{
if ($reset === TRUE) {
if ($reset === true) {
$this->api_headers = $headers;
} else {
$this->api_headers += $headers;
Expand Down Expand Up @@ -226,9 +226,9 @@ private function makeRequest($method, $request, $params = [], $headers = [])
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers_data);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, strtoupper($request));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->verify_ssl);

Expand All @@ -239,7 +239,7 @@ private function makeRequest($method, $request, $params = [], $headers = [])
$result = curl_exec($ch);
curl_close($ch);

return $result ? json_decode($result) : FALSE;
return $result ? json_decode($result) : false;
}


Expand Down