Code Duplication    Length = 10-12 lines in 8 locations

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

@@ 45-54 (lines=10) @@
42
     * @param array $config
43
     * @throws phpFastCacheDriverException
44
     */
45
    public function __construct(array $config = [])
46
    {
47
        $this->setup($config);
48
49
        if (!$this->driverCheck()) {
50
            throw new phpFastCacheDriverCheckException(sprintf(self::DRIVER_CHECK_FAILURE, $this->getDriverName()));
51
        } elseif (!$this->driverConnect()) {
52
            throw new phpFastCacheDriverException('Ssdb is not connected, cannot continue.');
53
        }
54
    }
55
56
    /**
57
     * @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/Memcached/Driver.php 1 location

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

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

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

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

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

src/phpFastCache/Drivers/Leveldb/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 string

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

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

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

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