Code Duplication    Length = 10-12 lines in 9 locations

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/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

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

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

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

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

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

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

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

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

src/phpFastCache/Drivers/Ssdb/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
        } elseif (!$this->driverConnect()) {
48
            throw new phpFastCacheDriverException('Ssdb is not connected, cannot continue.');
49
        }
50
    }
51
52
    /**
53
     * @return bool

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