Skip to content
This repository has been archived by the owner on Feb 6, 2025. It is now read-only.

Commit

Permalink
Merge pull request #51 from iwex/master
Browse files Browse the repository at this point in the history
styleci fixes
  • Loading branch information
marcus-campos authored Oct 24, 2017
2 parents 5c74426 + 1161f03 commit fbf4703
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* User: marcus-campos
* Date: 24/10/17
* Time: 12:33
* Time: 12:33.
*/

namespace Maestro\Cache;
Expand Down Expand Up @@ -57,7 +57,7 @@ public function cachable(int $time = 60)
private function fetchCachedIfExists()
{
// Generate a key to use for caching
$this->cacheKey = md5($this->url . $this->endPoint);
$this->cacheKey = md5($this->url.$this->endPoint);

// Set the response from APCu cache
if (apcu_exists($this->cacheKey)) {
Expand Down Expand Up @@ -85,15 +85,15 @@ private function makeCacheExpiryTime(): int
private function cacheResponseBody()
{
if (method_exists($this->response, 'getBody')) {
$this->responseBody = (string)$this->response->getBody();
$this->responseBody = (string) $this->response->getBody();
}

if ($this->cachingEnabled && $this->response->getReasonPhrase() === 'OK') {
$batch = [
'expires' => $this->makeCacheExpiryTime(),
'expires' => $this->makeCacheExpiryTime(),
'responseBody' => $this->responseBody,
];
apcu_store($this->cacheKey, $batch);
}
}
}
}
3 changes: 1 addition & 2 deletions src/Rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ public function body(array $body)
return $this;
}


/**
* Either sends the request or fetches a cached response body dependent on if caching is enabled.
*
Expand Down Expand Up @@ -220,7 +219,7 @@ function ($response) {
private function newRequest()
{
// GET method doesn't send a BODY
$paramsToSend = [$this->method, $this->url . $this->endPoint, $this->headers];
$paramsToSend = [$this->method, $this->url.$this->endPoint, $this->headers];

if ($this->method !== 'GET') {
$paramsToSend[] = $this->body;
Expand Down
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
* Add additional configuration/setup your application needs when running
* unit tests in this file.
*/
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'vendor/autoload.php';
require_once dirname(__DIR__).DIRECTORY_SEPARATOR.'vendor/autoload.php';

$_SERVER['PHP_SELF'] = '/';

0 comments on commit fbf4703

Please sign in to comment.