Completed
Push — develop ( c0c47b...cc4ea9 )
by Siad
04:17
created
src/Cache/Storage/Adapter/CouchbaseResourceManager.php 3 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -368,6 +368,9 @@  discard block
 block discarded – undo
368 368
         return $this;
369 369
     }
370 370
 
371
+    /**
372
+     * @param string $id
373
+     */
371 374
     public function getUsername($id)
372 375
     {
373 376
         if (!$this->hasResource($id)) {
@@ -405,6 +408,9 @@  discard block
 block discarded – undo
405 408
         return $this;
406 409
     }
407 410
 
411
+    /**
412
+     * @param string $id
413
+     */
408 414
     public function getBucket($id)
409 415
     {
410 416
         if (!$this->hasResource($id)) {
@@ -442,6 +448,9 @@  discard block
 block discarded – undo
442 448
         return $this;
443 449
     }
444 450
 
451
+    /**
452
+     * @param string $id
453
+     */
445 454
     public function getPassword($id)
446 455
     {
447 456
         if (!$this->hasResource($id)) {
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * zf-couchbase2.
4
- *
5
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
7
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
8
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
9
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
10
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
11
- * SOFTWARE.
12
- *
13
- * @copyright 2015 MehrAlsNix (http://www.mehralsnix.de)
14
- * @license   http://www.opensource.org/licenses/mit-license.php MIT
15
- *
16
- * @link      http://github.com/MehrAlsNix/zf-couchbase2
17
- */
3
+     * zf-couchbase2.
4
+     *
5
+     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6
+     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
7
+     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
8
+     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
9
+     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
10
+     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
11
+     * SOFTWARE.
12
+     *
13
+     * @copyright 2015 MehrAlsNix (http://www.mehralsnix.de)
14
+     * @license   http://www.opensource.org/licenses/mit-license.php MIT
15
+     *
16
+     * @link      http://github.com/MehrAlsNix/zf-couchbase2
17
+     */
18 18
 namespace MehrAlsNix\ZF\Cache\Storage\Adapter;
19 19
 
20 20
 use CouchbaseBucket as CouchbaseBucketResource;
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -76,26 +76,26 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/Cache/Storage/Adapter/Couchbase.php 3 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
     public function __construct($options = null)
69 69
     {
70 70
         if (static::$extCouchbaseMajorVersion === null) {
71
-            $v = (string) phpversion('couchbase');
72
-            static::$extCouchbaseMajorVersion = ($v !== '') ? (int) $v[0] : 0;
71
+            $v = (string)phpversion('couchbase');
72
+            static::$extCouchbaseMajorVersion = ($v !== '') ? (int)$v[0] : 0;
73 73
         }
74 74
         if (static::$extCouchbaseMajorVersion < 1) {
75 75
             throw new Exception\ExtensionNotLoadedException('Need ext/couchbase version >= 2.0.0');
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         parent::__construct($options);
78 78
         // reset initialized flag on update option(s)
79 79
         $initialized = &$this->initialized;
80
-        $this->getEventManager()->attach('option', function () use (&$initialized) {
80
+        $this->getEventManager()->attach('option', function() use (&$initialized) {
81 81
             $initialized = false;
82 82
         });
83 83
     }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     protected function internalSetItem(&$normalizedKey, &$value)
108 108
     {
109 109
         $memc = $this->getCouchbaseResource();
110
-        $internalKey = $this->namespacePrefix.$normalizedKey;
110
+        $internalKey = $this->namespacePrefix . $normalizedKey;
111 111
 
112 112
         try {
113 113
             $memc->upsert($internalKey, $value, ['expiry' => $this->expirationTime()]);
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
             $this->namespacePrefix = '';
142 142
 
143 143
             if ($namespace !== '') {
144
-                $this->namespacePrefix = $namespace.$options->getNamespaceSeparator();
144
+                $this->namespacePrefix = $namespace . $options->getNamespaceSeparator();
145 145
             }
146 146
 
147 147
             // update initialized flag
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
     protected function internalAddItem(&$normalizedKey, &$value)
223 223
     {
224 224
         $memc = $this->getCouchbaseResource();
225
-        $internalKey = $this->namespacePrefix.$normalizedKey;
225
+        $internalKey = $this->namespacePrefix . $normalizedKey;
226 226
         try {
227 227
             $memc->insert($internalKey, $value, ['expiry' => $this->expirationTime()]);
228 228
         } catch (\CouchbaseException $e) {
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
         $namespacedKeyValuePairs = [];
270 270
 
271 271
         foreach ($normalizedKeyValuePairs as $normalizedKey => &$value) {
272
-            $namespacedKeyValuePairs[$this->namespacePrefix.$normalizedKey] = ['value' => &$value];
272
+            $namespacedKeyValuePairs[$this->namespacePrefix . $normalizedKey] = ['value' => &$value];
273 273
         }
274 274
         unset($value);
275 275
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
         $result = true;
341 341
 
342 342
         try {
343
-            $memc->remove($this->namespacePrefix.$normalizedKey);
343
+            $memc->remove($this->namespacePrefix . $normalizedKey);
344 344
         } catch (\CouchbaseException $e) {
345 345
             $result = false;
346 346
         }
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
     protected function namespacesKeys(array &$normalizedKeys)
378 378
     {
379 379
         foreach ($normalizedKeys as &$normalizedKey) {
380
-            $normalizedKey = $this->namespacePrefix.$normalizedKey;
380
+            $normalizedKey = $this->namespacePrefix . $normalizedKey;
381 381
         }
382 382
     }
383 383
 
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
     protected function internalCheckAndSetItem(&$token, &$normalizedKey, &$value)
399 399
     {
400 400
         $memc = $this->getCouchbaseResource();
401
-        $key = $this->namespacePrefix.$normalizedKey;
401
+        $key = $this->namespacePrefix . $normalizedKey;
402 402
         $success = null;
403 403
         $this->internalGetItem($key, $success, $token);
404 404
 
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
      */
431 431
     protected function internalGetItem(&$normalizedKey, &$success = null, &$casToken = null)
432 432
     {
433
-        $internalKey = $this->namespacePrefix.$normalizedKey;
433
+        $internalKey = $this->namespacePrefix . $normalizedKey;
434 434
         $memc = $this->getCouchbaseResource();
435 435
 
436 436
         try {
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
         $memc = $this->getCouchbaseResource();
468 468
         $expiration = $this->expirationTime();
469 469
         try {
470
-            $memc->replace($this->namespacePrefix.$normalizedKey, $value, ['expiry' => $expiration]);
470
+            $memc->replace($this->namespacePrefix . $normalizedKey, $value, ['expiry' => $expiration]);
471 471
         } catch (\CouchbaseException $e) {
472 472
             $result = false;
473 473
         }
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
         $redis = $this->getCouchbaseResource();
490 490
         try {
491 491
             $ttl = $this->getOptions()->getTtl();
492
-            $redis->touch($this->namespacePrefix.$normalizedKey, $ttl);
492
+            $redis->touch($this->namespacePrefix . $normalizedKey, $ttl);
493 493
         } catch (\CouchbaseException $e) {
494 494
             if ($e->getCode() === CouchbaseErrors::LCB_KEY_EEXISTS
495 495
                 || $e->getCode() === CouchbaseErrors::LCB_KEY_ENOENT
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
     protected function internalHasItem(&$normalizedKey)
515 515
     {
516 516
         $memc = $this->getCouchbaseResource();
517
-        $internalKey = $this->namespacePrefix.$normalizedKey;
517
+        $internalKey = $this->namespacePrefix . $normalizedKey;
518 518
 
519 519
         try {
520 520
             $result = $memc->get($internalKey)->value;
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
             }
527 527
         }
528 528
 
529
-        return (bool) $result;
529
+        return (bool)$result;
530 530
     }
531 531
 
532 532
     /**
@@ -620,8 +620,8 @@  discard block
 block discarded – undo
620 620
     protected function internalIncrementItem(&$normalizedKey, &$value)
621 621
     {
622 622
         $couchbaseBucket = $this->getCouchbaseResource();
623
-        $internalKey = $this->namespacePrefix.$normalizedKey;
624
-        $value = (int) $value;
623
+        $internalKey = $this->namespacePrefix . $normalizedKey;
624
+        $value = (int)$value;
625 625
         $newValue = false;
626 626
 
627 627
         try {
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * zf-couchbase2.
4
- *
5
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
7
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
8
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
9
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
10
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
11
- * SOFTWARE.
12
- *
13
- * @copyright 2015 MehrAlsNix (http://www.mehralsnix.de)
14
- * @license   http://www.opensource.org/licenses/mit-license.php MIT
15
- *
16
- * @link      http://github.com/MehrAlsNix/zf-couchbase2
17
- */
3
+     * zf-couchbase2.
4
+     *
5
+     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6
+     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
7
+     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
8
+     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
9
+     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
10
+     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
11
+     * SOFTWARE.
12
+     *
13
+     * @copyright 2015 MehrAlsNix (http://www.mehralsnix.de)
14
+     * @license   http://www.opensource.org/licenses/mit-license.php MIT
15
+     *
16
+     * @link      http://github.com/MehrAlsNix/zf-couchbase2
17
+     */
18 18
 namespace MehrAlsNix\ZF\Cache\Storage\Adapter;
19 19
 
20 20
 use CouchbaseBucket as CouchbaseBucketResource;
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     /**
62 62
      * Constructor.
63 63
      *
64
-     * @param null|array|\Traversable|CouchbaseOptions $options
64
+     * @param CouchbaseOptions $options
65 65
      *
66 66
      * @throws Exception\ExceptionInterface
67 67
      */
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
     /**
171 171
      * Set options.
172 172
      *
173
-     * @param array|\Traversable|CouchbaseOptions $options
173
+     * @param CouchbaseOptions $options
174 174
      *
175
-     * @return \CouchbaseCluster
175
+     * @return AbstractAdapter
176 176
      *
177 177
      * @see    getOptions()
178 178
      */
Please login to merge, or discard this patch.
src/Cache/Storage/Adapter/CouchbaseOptions.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public function setNamespace($namespace)
63 63
     {
64
-        $namespace = (string) $namespace;
64
+        $namespace = (string)$namespace;
65 65
 
66 66
         if (128 < strlen($namespace)) {
67 67
             throw new Exception\InvalidArgumentException(sprintf(
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function setNamespaceSeparator($namespaceSeparator)
84 84
     {
85
-        $namespaceSeparator = (string) $namespaceSeparator;
85
+        $namespaceSeparator = (string)$namespaceSeparator;
86 86
         if ($this->namespaceSeparator !== $namespaceSeparator) {
87 87
             $this->triggerOptionEvent('namespace_separator', $namespaceSeparator);
88 88
             $this->namespaceSeparator = $namespaceSeparator;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      */
152 152
     public function setResourceId($resourceId)
153 153
     {
154
-        $resourceId = (string) $resourceId;
154
+        $resourceId = (string)$resourceId;
155 155
         if ($this->resourceId !== $resourceId) {
156 156
             $this->triggerOptionEvent('resource_id', $resourceId);
157 157
             $this->resourceId = $resourceId;
Please login to merge, or discard this patch.