RedisHandler::getConnection()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 7
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
namespace SimpleDIC\Dummy;
4
5
class RedisHandler
6
{
7
8
    /**
9
     * @var Client
10
     */
11
    private $client;
12
13
    /**
14
     * @var string
15
     */
16
    private $dns;
17
18
    /**
19
     * RedisHandler constructor.
20
     *
21
     * @param string $dns
22
     */
23
    public function __construct($dns)
24
    {
25
        $this->dns = $dns;
26
    }
27
28
    /**
29
     * @return Client
30
     */
31
    public function getConnection()
32
    {
33
        if ($this->client === null) {
34
            $this->client = new Client('dummy', '12432');
35
        }
36
37
        return $this->client;
38
    }
39
}
40