Skip to content

Commit

Permalink
Apply fixes from StyleCI (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyholm committed Jan 13, 2018
1 parent 8be83a9 commit 24325ab
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/Resources/proxy/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ class __TPL_CLASS__ extends __TPL_EXTENDS__ implements CacheProxyInterface
public function getItem($key)
{
$event = $this->start(__FUNCTION__, $key);

try {
$item = parent::getItem($key);
} finally {
$event->end = microtime(true);
}
if ($item->isHit()) {
++$event->hits;
$event->hits++;
} else {
++$event->misses;
$event->misses++;
}
$event->result = $item->get();

Expand All @@ -39,14 +40,15 @@ public function getItem($key)
public function hasItem($key)
{
$event = $this->start(__FUNCTION__, $key);

try {
$event->result = parent::hasItem($key);
} finally {
$event->end = microtime(true);
}

if (!$event->result) {
++$event->misses;
$event->misses++;
}

return $event->result;
Expand All @@ -55,6 +57,7 @@ public function hasItem($key)
public function deleteItem($key)
{
$event = $this->start(__FUNCTION__, $key);

try {
return $event->result = parent::deleteItem($key);
} finally {
Expand All @@ -65,6 +68,7 @@ public function deleteItem($key)
public function save(CacheItemInterface $item)
{
$event = $this->start(__FUNCTION__, $item);

try {
return $event->result = parent::save($item);
} finally {
Expand All @@ -75,6 +79,7 @@ public function save(CacheItemInterface $item)
public function saveDeferred(CacheItemInterface $item)
{
$event = $this->start(__FUNCTION__, $item);

try {
return $event->result = parent::saveDeferred($item);
} finally {
Expand All @@ -85,6 +90,7 @@ public function saveDeferred(CacheItemInterface $item)
public function getItems(array $keys = [])
{
$event = $this->start(__FUNCTION__, $keys);

try {
$result = parent::getItems($keys);
} finally {
Expand All @@ -94,9 +100,9 @@ public function getItems(array $keys = [])
$event->result = [];
foreach ($result as $key => $item) {
if ($item->isHit()) {
++$event->hits;
$event->hits++;
} else {
++$event->misses;
$event->misses++;
}
$event->result[$key] = $item->get();
yield $key => $item;
Expand All @@ -109,6 +115,7 @@ public function getItems(array $keys = [])
public function clear()
{
$event = $this->start(__FUNCTION__);

try {
return $event->result = parent::clear();
} finally {
Expand All @@ -119,6 +126,7 @@ public function clear()
public function deleteItems(array $keys)
{
$event = $this->start(__FUNCTION__, $keys);

try {
return $event->result = parent::deleteItems($keys);
} finally {
Expand All @@ -129,6 +137,7 @@ public function deleteItems(array $keys)
public function commit()
{
$event = $this->start(__FUNCTION__);

try {
return $event->result = parent::commit();
} finally {
Expand All @@ -139,6 +148,7 @@ public function commit()
public function invalidateTag($tag)
{
$event = $this->start(__FUNCTION__, $tag);

try {
return $event->result = parent::invalidateTag($tag);
} finally {
Expand All @@ -149,6 +159,7 @@ public function invalidateTag($tag)
public function invalidateTags(array $tags)
{
$event = $this->start(__FUNCTION__, $tags);

try {
return $event->result = parent::invalidateTags($tags);
} finally {
Expand Down

0 comments on commit 24325ab

Please sign in to comment.