Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
Breaking up the conditionals for clearer test coverage reporting.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbisbee committed Jul 25, 2011
1 parent 5cf28c9 commit f8b64c0
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/Sag.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,21 @@ public function get($url)
$url = self::setURLParameter($url, 'stale', 'ok');

//Deal with cached items
if($this->cache && ($prevResponse = $this->cache->get($url)))
if($this->cache)
{
$response = $this->procPacket('GET', $url, null, array('If-None-Match' => $prevResponse->headers->Etag));
$prevResponse = $this->cache->get($url);

if($prevResponse)
{
$response = $this->procPacket('GET', $url, null, array('If-None-Match' => $prevResponse->headers->Etag));

if($response->headers->_HTTP->status == 304)
return $prevResponse; //cache hit
if($response->headers->_HTTP->status == 304)
return $prevResponse; //cache hit

$this->cache->remove($url);
$this->cache->remove($url);
}

unset($prevResponse);
}

//Not caching, or we are caching but there's nothing cached yet, or our
Expand Down

0 comments on commit f8b64c0

Please sign in to comment.