Code Duplication    Length = 10-12 lines in 8 locations

src/phpFastCache/Drivers/Memcached/Driver.php 1 location

@@ 39-50 (lines=12) @@
36
     * @param array $config
37
     * @throws phpFastCacheDriverException
38
     */
39
    public function __construct(array $config = [])
40
    {
41
        self::checkCollision('Memcached');
42
        $this->setup($config);
43
44
        if (!$this->driverCheck()) {
45
            throw new phpFastCacheDriverCheckException(sprintf(self::DRIVER_CHECK_FAILURE, $this->getDriverName()));
46
        } else {
47
            $this->instance = new MemcachedSoftware();
48
            $this->driverConnect();
49
        }
50
    }
51
52
    /**
53
     * @return bool

src/phpFastCache/Drivers/Ssdb/Driver.php 1 location

@@ 43-52 (lines=10) @@
40
     * @param array $config
41
     * @throws phpFastCacheDriverException
42
     */
43
    public function __construct(array $config = [])
44
    {
45
        $this->setup($config);
46
47
        if (!$this->driverCheck()) {
48
            throw new phpFastCacheDriverCheckException(sprintf(self::DRIVER_CHECK_FAILURE, $this->getDriverName()));
49
        } elseif (!$this->driverConnect()) {
50
            throw new phpFastCacheDriverException('Ssdb is not connected, cannot continue.');
51
        }
52
    }
53
54
    /**
55
     * @return bool

src/phpFastCache/Drivers/Couchbase/Driver.php 1 location

@@ 51-60 (lines=10) @@
48
     * @param array $config
49
     * @throws phpFastCacheDriverException
50
     */
51
    public function __construct(array $config = [])
52
    {
53
        $this->setup($config);
54
55
        if (!$this->driverCheck()) {
56
            throw new phpFastCacheDriverCheckException(sprintf(self::DRIVER_CHECK_FAILURE, $this->getDriverName()));
57
        } else {
58
            $this->driverConnect();
59
        }
60
    }
61
62
    /**
63
     * @return bool

src/phpFastCache/Drivers/Leveldb/Driver.php 1 location

@@ 47-56 (lines=10) @@
44
     * @param array $config
45
     * @throws phpFastCacheDriverException
46
     */
47
    public function __construct(array $config = [])
48
    {
49
        $this->setup($config);
50
51
        if (!$this->driverCheck()) {
52
            throw new phpFastCacheDriverCheckException(sprintf(self::DRIVER_CHECK_FAILURE, $this->getDriverName()));
53
        } else {
54
            $this->driverConnect();
55
        }
56
    }
57
58
    /**
59
     * @return string

src/phpFastCache/Drivers/Mongo/Driver.php 1 location

@@ 46-55 (lines=10) @@
43
     * @param array $config
44
     * @throws phpFastCacheDriverException
45
     */
46
    public function __construct(array $config = [])
47
    {
48
        $this->setup($config);
49
50
        if (!$this->driverCheck()) {
51
            throw new phpFastCacheDriverCheckException(sprintf(self::DRIVER_CHECK_FAILURE, $this->getDriverName()));
52
        } else {
53
            $this->driverConnect();
54
        }
55
    }
56
57
    /**
58
     * @return bool

src/phpFastCache/Drivers/Mongodb/Driver.php 1 location

@@ 49-58 (lines=10) @@
46
     * @param array $config
47
     * @throws phpFastCacheDriverException
48
     */
49
    public function __construct(array $config = [])
50
    {
51
        $this->setup($config);
52
53
        if (!$this->driverCheck()) {
54
            throw new phpFastCacheDriverCheckException(sprintf(self::DRIVER_CHECK_FAILURE, $this->getDriverName()));
55
        } else {
56
            $this->driverConnect();
57
        }
58
    }
59
60
    /**
61
     * @return bool

src/phpFastCache/Drivers/Predis/Driver.php 1 location

@@ 41-50 (lines=10) @@
38
     * @param array $config
39
     * @throws phpFastCacheDriverException
40
     */
41
    public function __construct(array $config = [])
42
    {
43
        $this->setup($config);
44
45
        if (!$this->driverCheck()) {
46
            throw new phpFastCacheDriverCheckException(sprintf(self::DRIVER_CHECK_FAILURE, $this->getDriverName()));
47
        } else {
48
            $this->driverConnect();
49
        }
50
    }
51
52
    /**
53
     * @return bool

src/phpFastCache/Drivers/Redis/Driver.php 1 location

@@ 36-45 (lines=10) @@
33
     * @param array $config
34
     * @throws phpFastCacheDriverException
35
     */
36
    public function __construct(array $config = [])
37
    {
38
        $this->setup($config);
39
40
        if (!$this->driverCheck()) {
41
            throw new phpFastCacheDriverCheckException(sprintf(self::DRIVER_CHECK_FAILURE, $this->getDriverName()));
42
        } else {
43
            $this->driverConnect();
44
        }
45
    }
46
47
    /**
48
     * @return bool