Completed
Push — master ( 9f316b...521c5d )
by Mehmet
02:30
created

RedisCacheTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 3
Bugs 1 Features 2
Metric Value
wmc 1
c 3
b 1
f 2
lcom 1
cbo 2
dl 15
loc 15
rs 10

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
namespace tests;
3
4
use Soupmix\Cache as c;
5
use Redis;
6
class RedisCacheTest extends AbstractTestCases
7
{
8
    /**
9
     * @var \Soupmix\Cache\RedisCache $client
10
     */
11
    protected $client = null;
12
13
    protected function setUp()
14
    {
15
        $handler = new Redis();
16
        $handler->connect(
17
            $this->redisConfig['host'],
18
            $this->redisConfig['port'],
19
            $this->redisConfig['timeout'],
20
            null,
21
            $this->redisConfig['reconnectAttempt']
22
        );
23
        $handler->select($this->redisConfig['dbIndex']);
24
        $this->client = new c\RedisCache($handler);
25
        $this->client->clear();
26
    }
27
}
28