@@ -76,26 +76,26 @@ discard block |
||
| 76 | 76 | if (is_array($server)) { |
| 77 | 77 | // array(<host>[, <port>]) |
| 78 | 78 | if (isset($server[0])) { |
| 79 | - $host = (string) $server[0]; |
|
| 80 | - $port = isset($server[1]) ? (int) $server[1] : $port; |
|
| 79 | + $host = (string)$server[0]; |
|
| 80 | + $port = isset($server[1]) ? (int)$server[1] : $port; |
|
| 81 | 81 | } |
| 82 | 82 | // array('host' => <host>[, 'port' => <port>]) |
| 83 | 83 | if (!isset($server[0]) && isset($server['host'])) { |
| 84 | - $host = (string) $server['host']; |
|
| 85 | - $port = isset($server['port']) ? (int) $server['port'] : $port; |
|
| 84 | + $host = (string)$server['host']; |
|
| 85 | + $port = isset($server['port']) ? (int)$server['port'] : $port; |
|
| 86 | 86 | } |
| 87 | 87 | } else { |
| 88 | 88 | // parse server from URI host{:?port} |
| 89 | 89 | $server = trim($server); |
| 90 | 90 | if (strpos($server, '://') === false) { |
| 91 | - $server = 'couchbase://'.$server; |
|
| 91 | + $server = 'couchbase://' . $server; |
|
| 92 | 92 | } |
| 93 | 93 | $server = parse_url($server); |
| 94 | 94 | if (!$server) { |
| 95 | 95 | throw new Exception\InvalidArgumentException('Invalid server given'); |
| 96 | 96 | } |
| 97 | 97 | $host = $server['host']; |
| 98 | - $port = isset($server['port']) ? (int) $server['port'] : $port; |
|
| 98 | + $port = isset($server['port']) ? (int)$server['port'] : $port; |
|
| 99 | 99 | if (isset($server['query'])) { |
| 100 | 100 | $query = null; |
| 101 | 101 | parse_str($server['query'], $query); |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | if ($resource instanceof \CouchbaseBucket) { |
| 141 | 141 | return $resource; |
| 142 | 142 | } |
| 143 | - $memc = new CouchbaseClusterResource('couchbase://'.$resource['server'][0]['host'].':'.$resource['server'][0]['port'], (string) $resource['username'], (string) $resource['password'], \COUCHBASE_SERTYPE_PHP); |
|
| 144 | - $bucket = $memc->openBucket((string) $resource['bucket'], (string) $resource['password']); |
|
| 143 | + $memc = new CouchbaseClusterResource('couchbase://' . $resource['server'][0]['host'] . ':' . $resource['server'][0]['port'], (string)$resource['username'], (string)$resource['password'], \COUCHBASE_SERTYPE_PHP); |
|
| 144 | + $bucket = $memc->openBucket((string)$resource['bucket'], (string)$resource['password']); |
|
| 145 | 145 | /* |
| 146 | 146 | $bucket->setTranscoder( |
| 147 | 147 | '\MehrAlsNix\ZF\Cache\Storage\Adapter\CouchbaseResourceManager::encoder', |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | public function setResource($id, $resource) |
| 170 | 170 | { |
| 171 | - $id = (string) $id; |
|
| 171 | + $id = (string)$id; |
|
| 172 | 172 | if (!($resource instanceof CouchbaseBucketResource)) { |
| 173 | 173 | if ($resource instanceof \Traversable) { |
| 174 | 174 | $resource = ArrayUtils::iteratorToArray($resource); |
@@ -228,13 +228,13 @@ discard block |
||
| 228 | 228 | { |
| 229 | 229 | // convert option name into it's constant value |
| 230 | 230 | if (is_string($key)) { |
| 231 | - $const = '\\COUCHBASE_'.str_replace([' ', '-'], '_', strtoupper($key)); |
|
| 231 | + $const = '\\COUCHBASE_' . str_replace([' ', '-'], '_', strtoupper($key)); |
|
| 232 | 232 | if (!defined($const)) { |
| 233 | 233 | throw new Exception\InvalidArgumentException("Unknown libcouchbase option '{$key}' ({$const})"); |
| 234 | 234 | } |
| 235 | 235 | $key = constant($const); |
| 236 | 236 | } else { |
| 237 | - $key = (int) $key; |
|
| 237 | + $key = (int)$key; |
|
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | $result = []; |
| 519 | 519 | foreach ($servers as $server) { |
| 520 | 520 | $this->normalizeServer($server); |
| 521 | - $result[$server['host'].':'.$server['port']] = $server; |
|
| 521 | + $result[$server['host'] . ':' . $server['port']] = $server; |
|
| 522 | 522 | } |
| 523 | 523 | $servers = array_values($result); |
| 524 | 524 | } |
@@ -534,8 +534,8 @@ discard block |
||
| 534 | 534 | */ |
| 535 | 535 | protected function compareServers(array $serverA, array $serverB) |
| 536 | 536 | { |
| 537 | - $keyA = $serverA['host'].':'.$serverA['port']; |
|
| 538 | - $keyB = $serverB['host'].':'.$serverB['port']; |
|
| 537 | + $keyA = $serverA['host'] . ':' . $serverA['port']; |
|
| 538 | + $keyB = $serverB['host'] . ':' . $serverB['port']; |
|
| 539 | 539 | if ($keyA === $keyB) { |
| 540 | 540 | return 0; |
| 541 | 541 | } |