Code Duplication    Length = 29-29 lines in 2 locations

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

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

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

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