Skip to content

Commit

Permalink
Change getPools to protected (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
prisis authored and Nyholm committed Aug 7, 2016
1 parent bbc23d3 commit 83b9862
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions CachePoolChain.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,28 +58,6 @@ public function __construct(array $pools, array $options = [])
$this->options = $resolver->resolve($options);
}

/**
* @param string $poolKey
* @param string $operation
* @param CachePoolException $exception
*
* @throws PoolFailedException
*/
private function handleException($poolKey, $operation, CachePoolException $exception)
{
if (!$this->options['skip_on_failure']) {
throw $exception;
}

$this->log(
'warning',
sprintf('Removing pool "%s" from chain because it threw an exception when executing "%s"', $poolKey, $operation),
['exception' => $exception]
);

unset($this->pools[$poolKey]);
}

/**
* @param OptionsResolver $resolver
*/
Expand All @@ -90,18 +68,6 @@ public function configureOptions(OptionsResolver $resolver)
]);
}

/**
* @return array|\Psr\Cache\CacheItemPoolInterface[]
*/
public function getPools()
{
if (empty($this->pools)) {
throw new NoPoolAvailableException('No valid cache pool available for the chain.');
}

return $this->pools;
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -328,4 +294,38 @@ protected function log($level, $message, array $context = [])
$this->logger->log($level, $message, $context);
}
}

/**
* @return array|\Psr\Cache\CacheItemPoolInterface[]
*/
protected function getPools()
{
if (empty($this->pools)) {
throw new NoPoolAvailableException('No valid cache pool available for the chain.');
}

return $this->pools;
}

/**
* @param string $poolKey
* @param string $operation
* @param CachePoolException $exception
*
* @throws PoolFailedException
*/
private function handleException($poolKey, $operation, CachePoolException $exception)
{
if (!$this->options['skip_on_failure']) {
throw $exception;
}

$this->log(
'warning',
sprintf('Removing pool "%s" from chain because it threw an exception when executing "%s"', $poolKey, $operation),
['exception' => $exception]
);

unset($this->pools[$poolKey]);
}
}

0 comments on commit 83b9862

Please sign in to comment.