Passed
Push — master ( 357df8...5617f0 )
by Georges
02:00 queued 12s
created

Item   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 27
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A setDriver() 0 9 2
1
<?php
2
3
/**
4
 *
5
 * This file is part of phpFastCache.
6
 *
7
 * @license MIT License (MIT)
8
 *
9
 * For full copyright and license information, please see the docs/CREDITS.txt file.
10
 *
11
 * @author Khoa Bui (khoaofgod)  <[email protected]> https://www.phpfastcache.com
12
 * @author Georges.L (Geolim4)  <[email protected]>
13
 *
14
 */
15
declare(strict_types=1);
16
17
namespace Phpfastcache\Drivers\Couchbasev3;
18
19
use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface;
20
use Phpfastcache\Drivers\Couchbase\Item as CoubaseV2Item;
21
use Phpfastcache\Drivers\Couchbasev3\Driver as CouchbaseDriver;
22
use Phpfastcache\Exceptions\PhpfastcacheInvalidArgumentException;
23
24
/**
25
 * Class Item
26
 * @package phpFastCache\Drivers\Couchbase
27
 */
28
class Item extends CoubaseV2Item
29
{
30
    /**
31
     * Item constructor.
32
     * @param Driver $driver
33
     * @param $key
34
     * @throws PhpfastcacheInvalidArgumentException
35
     */
36
    public function __construct(CouchbaseDriver $driver, $key)
37
    {
38
        parent::__construct($driver, $key);
39
    }
40
41
    /**
42
     * @param ExtendedCacheItemPoolInterface $driver
43
     * @return static
44
     * @throws PhpfastcacheInvalidArgumentException
45
     */
46
    public function setDriver(ExtendedCacheItemPoolInterface $driver)
47
    {
48
        if ($driver instanceof CouchbaseDriver) {
49
            $this->driver = $driver;
50
51
            return $this;
52
        }
53
54
        throw new PhpfastcacheInvalidArgumentException('Invalid driver instance');
55
    }
56
}
57