Completed
Push — master ( ee9a51...a02f02 )
by Tobias
21:27 queued 19:30
created

Memcached::addServer()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 4.5923

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 4
cts 6
cp 0.6667
rs 9.9
c 0
b 0
f 0
cc 4
nc 3
nop 3
crap 4.5923
1
<?php
2
3
/*
4
 * This file is part of php-cache organization.
5
 *
6
 * (c) 2015 Aaron Scherer <[email protected]>, Tobias Nyholm <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Cache\AdapterBundle\ProviderHelper;
13
14
/**
15
 * Class Memcached.
16
 *
17
 * @author Aaron Scherer <[email protected]>
18
 */
19
class Memcached extends \Memcached
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24 3
    public function addServer($host, $port, $weight = 0)
25
    {
26 3
        $serverList = $this->getServerList();
27 3
        foreach ($serverList as $server) {
28
            if ($server['host'] === $host && $server['port'] === $port) {
29
                return false;
30
            }
31
        }
32
33 3
        return parent::addServer($host, $port, $weight);
34
    }
35
}
36