@@ -115,14 +115,11 @@ discard block |
||
| 115 | 115 | try { |
| 116 | 116 | if (is_object($client)) { |
| 117 | 117 | $this->driver = $client; |
| 118 | - } |
|
| 119 | - elseif (is_object($server)) { |
|
| 118 | + } elseif (is_object($server)) { |
|
| 120 | 119 | $this->driver = $server; |
| 121 | - } |
|
| 122 | - elseif (is_array($server)) { |
|
| 120 | + } elseif (is_array($server)) { |
|
| 123 | 121 | $this->driver = new Credis_Cluster($server); |
| 124 | - } |
|
| 125 | - else { |
|
| 122 | + } else { |
|
| 126 | 123 | list($host, $port, $dsnDatabase, $user, $password, $options) = self::parseDsn($server); |
| 127 | 124 | // $user is not used, only $password |
| 128 | 125 | |
@@ -147,8 +144,7 @@ discard block |
||
| 147 | 144 | if ($database !== null) { |
| 148 | 145 | $this->driver->select($database); |
| 149 | 146 | } |
| 150 | - } |
|
| 151 | - catch(CredisException $e) { |
|
| 147 | + } catch(CredisException $e) { |
|
| 152 | 148 | throw new Resque_RedisException('Error communicating with Redis: ' . $e->getMessage(), 0, $e); |
| 153 | 149 | } |
| 154 | 150 | } |
@@ -221,12 +217,10 @@ discard block |
||
| 221 | 217 | if($options && isset($options['password-encoding']) && $options['password-encoding'] === 'u'){ |
| 222 | 218 | //extracting urlencoded password |
| 223 | 219 | $pass = isset($parts['pass']) ? urldecode($parts['pass']) : false; |
| 224 | - } |
|
| 225 | - else if($options && isset($options['password-encoding']) && $options['password-encoding'] === 'b'){ |
|
| 220 | + } else if($options && isset($options['password-encoding']) && $options['password-encoding'] === 'b'){ |
|
| 226 | 221 | //extracting base64 encoded password |
| 227 | 222 | $pass = isset($parts['pass']) ? base64_decode($parts['pass']) : false; |
| 228 | - } |
|
| 229 | - else{ |
|
| 223 | + } else{ |
|
| 230 | 224 | //extracting pass directly since 'password-encoding' parameter is not present |
| 231 | 225 | $pass = isset($parts['pass']) ? $parts['pass'] : false; |
| 232 | 226 | } |
@@ -256,15 +250,13 @@ discard block |
||
| 256 | 250 | foreach ($args[0] AS $i => $v) { |
| 257 | 251 | $args[0][$i] = self::$defaultNamespace . $v; |
| 258 | 252 | } |
| 259 | - } |
|
| 260 | - else { |
|
| 253 | + } else { |
|
| 261 | 254 | $args[0] = self::$defaultNamespace . $args[0]; |
| 262 | 255 | } |
| 263 | 256 | } |
| 264 | 257 | try { |
| 265 | 258 | return $this->driver->__call($name, $args); |
| 266 | - } |
|
| 267 | - catch (CredisException $e) { |
|
| 259 | + } catch (CredisException $e) { |
|
| 268 | 260 | throw new Resque_RedisException('Error communicating with Redis: ' . $e->getMessage(), 0, $e); |
| 269 | 261 | } |
| 270 | 262 | } |