Code Duplication    Length = 22-22 lines in 2 locations

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

@@ 129-150 (lines=22) @@
126
    /**
127
     * @return bool
128
     */
129
    protected function driverConnect()
130
    {
131
        $servers = (!empty($this->config[ 'memcache' ]) && is_array($this->config[ 'memcache' ]) ? $this->config[ 'memcache' ] : []);
132
        if (count($servers) < 1) {
133
            $servers = [
134
              ['127.0.0.1', 11211],
135
            ];
136
        }
137
138
        foreach ($servers as $server) {
139
            try {
140
                if (!$this->instance->addserver($server[ 0 ], $server[ 1 ])) {
141
                    $this->fallback = true;
142
                }
143
                if(!empty($server[ 'sasl_user' ]) && !empty($server[ 'sasl_password'])){
144
                    $this->instance->setSaslAuthData($server[ 'sasl_user' ], $server[ 'sasl_password']);
145
                }
146
            } catch (\Exception $e) {
147
                $this->fallback = true;
148
            }
149
        }
150
    }
151
152
    /********************
153
     *

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

@@ 128-149 (lines=22) @@
125
    /**
126
     * @return bool
127
     */
128
    protected function driverConnect()
129
    {
130
        $servers = (!empty($this->config[ 'memcache' ]) && is_array($this->config[ 'memcache' ]) ? $this->config[ 'memcache' ] : []);
131
        if (count($servers) < 1) {
132
            $servers = [
133
              ['127.0.0.1', 11211],
134
            ];
135
        }
136
137
        foreach ($servers as $server) {
138
            try {
139
                if (!$this->instance->addServer($server[ 0 ], $server[ 1 ])) {
140
                    $this->fallback = true;
141
                }
142
                if(!empty($server[ 'sasl_user' ]) && !empty($server[ 'sasl_password'])){
143
                    $this->instance->setSaslAuthData($server[ 'sasl_user' ], $server[ 'sasl_password']);
144
                }
145
            } catch (\Exception $e) {
146
                $this->fallback = true;
147
            }
148
        }
149
    }
150
151
    /********************
152
     *