Code Duplication    Length = 10-11 lines in 9 locations

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

@@ 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/Couchdb/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 bool

src/phpFastCache/Drivers/Leveldb/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
        } else {
50
            $this->driverConnect();
51
        }
52
    }
53
54
    /**
55
     * @return string

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

@@ 41-51 (lines=11) @@
38
     * @param array $config
39
     * @throws phpFastCacheDriverException
40
     */
41
    public function __construct(array $config = [])
42
    {
43
        self::checkCollision('Memcached');
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 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

@@ 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/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/Mongodb/Driver.php 1 location

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