12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- namespace Predis;
- use Predis\Connection\AggregatedConnectionInterface;
- use Predis\Connection\ClusterConnectionInterface;
- use Predis\Connection\ConnectionInterface;
- class Helpers
- {
-
- public static function onCommunicationException(CommunicationException $exception)
- {
- if ($exception->shouldResetConnection()) {
- $connection = $exception->getConnection();
- if ($connection->isConnected()) {
- $connection->disconnect();
- }
- }
- throw $exception;
- }
-
- public static function filterArrayArguments(Array $arguments)
- {
- if (count($arguments) === 1 && is_array($arguments[0])) {
- return $arguments[0];
- }
- return $arguments;
- }
-
- public static function filterVariadicValues(Array $arguments)
- {
- if (count($arguments) === 2 && is_array($arguments[1])) {
- return array_merge(array($arguments[0]), $arguments[1]);
- }
- return $arguments;
- }
- }
|