Completed
Push — master ( 4aafbf...33c9c4 )
by Georges
19s queued 11s
created

Config::setOptPrefix()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Geolim4
5
 * Date: 12/02/2018
6
 * Time: 23:10
7
 */
8
9
namespace Phpfastcache\Drivers\Redis;
10
11
use Phpfastcache\Config\ConfigurationOption;
12
use Redis as RedisClient;
13
14
class Config extends ConfigurationOption
15
{
16
    /**
17
     * @var string
18
     */
19
    protected $host = '127.0.0.1';
20
21
    /**
22
     * @var int
23
     */
24
    protected $port = 6379;
25
26
    /**
27
     * @var string
28
     */
29
    protected $password = '';
30
31
    /**
32
     * @var int
33
     */
34
    protected $database = 0;
35
36
    /**
37
     * @var int
38
     */
39
    protected $timeout = 5;
40
41
    /**
42
     * @var RedisClient
43
     */
44
    protected $redisClient;
45
46
    /**
47
     * @var string
48
     */
49
    protected $optPrefix = '';
50
51
    /**
52
     * @return string
53
     */
54
    public function getHost(): string
55
    {
56
        return $this->host;
57
    }
58
59
    /**
60
     * @param string $host
61
     * @return self
62
     */
63
    public function setHost(string $host): self
64
    {
65
        $this->host = $host;
66
        return $this;
67
    }
68
69
    /**
70
     * @return int
71
     */
72
    public function getPort(): int
73
    {
74
        return $this->port;
75
    }
76
77
    /**
78
     * @param int $port
79
     * @return self
80
     */
81
    public function setPort(int $port): self
82
    {
83
        $this->port = $port;
84
        return $this;
85
    }
86
87
    /**
88
     * @return mixed
89
     */
90
    public function getPassword()
91
    {
92
        return $this->password;
93
    }
94
95
    /**
96
     * @param string $password
97
     * @return self
98
     */
99
    public function setPassword(string $password): self
100
    {
101
        $this->password = $password;
102
        return $this;
103
    }
104
105
    /**
106
     * @return int
107
     */
108
    public function getDatabase(): int
109
    {
110
        return $this->database;
111
    }
112
113
    /**
114
     * @param int $database
115
     * @return self
116
     */
117
    public function setDatabase(int $database): self
118
    {
119
        $this->database = $database;
120
        return $this;
121
    }
122
123
    /**
124
     * @return int
125
     */
126
    public function getTimeout(): int
127
    {
128
        return $this->timeout;
129
    }
130
131
    /**
132
     * @param int $timeout
133
     * @return self
134
     */
135
    public function setTimeout(int $timeout): self
136
    {
137
        $this->timeout = $timeout;
138
        return $this;
139
    }
140
141
    /**
142
     * @return RedisClient|null
143
     */
144
    public function getRedisClient()
145
    {
146
        return $this->redisClient;
147
    }
148
149
    /**
150
     * @param RedisClient $predisClient |null
151
     * @return Config
152
     */
153
    public function setRedisClient(RedisClient $redisClient = null): Config
154
    {
155
        $this->redisClient = $redisClient;
156
        return $this;
157
    }
158
159
    /**
160
     * @return string
161
     * @since 7.0.2
162
     */
163
    public function getOptPrefix(): string
164
    {
165
        return $this->optPrefix;
166
    }
167
168
    /**
169
     * @param string $optPrefix
170
     * @return Config
171
     * @since 7.0.2
172
     */
173
    public function setOptPrefix(string $optPrefix): Config
174
    {
175
        $this->optPrefix = trim($optPrefix);
176
        return $this;
177
    }
178
}