Code Duplication    Length = 27-27 lines in 2 locations

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

@@ 130-156 (lines=27) @@
127
    /**
128
     * @return bool
129
     */
130
    protected function driverConnect()
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

@@ 129-155 (lines=27) @@
126
    /**
127
     * @return bool
128
     */
129
    protected function driverConnect()
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
     *