1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* |
5
|
|
|
* This file is part of Phpfastcache. |
6
|
|
|
* |
7
|
|
|
* @license MIT License (MIT) |
8
|
|
|
* |
9
|
|
|
* For full copyright and license information, please see the docs/CREDITS.txt and LICENCE files. |
10
|
|
|
* |
11
|
|
|
* @author Georges.L (Geolim4) <[email protected]> |
12
|
|
|
* @author Contributors https://github.com/PHPSocialNetwork/phpfastcache/graphs/contributors |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
declare(strict_types=1); |
16
|
|
|
|
17
|
|
|
namespace Phpfastcache\Drivers\Couchbasev3; |
18
|
|
|
|
19
|
|
|
use Phpfastcache\Config\ConfigurationOption; |
20
|
|
|
use Phpfastcache\Exceptions\PhpfastcacheLogicException; |
21
|
|
|
|
22
|
|
|
class Config extends ConfigurationOption |
23
|
|
|
{ |
24
|
|
|
protected const DEFAULT_VALUE = '_default'; |
25
|
|
|
protected string $host = '127.0.0.1'; |
26
|
|
|
protected int $port = 8091; |
27
|
|
|
// SSL: 18091 |
28
|
|
|
|
29
|
|
|
protected string $username = ''; |
30
|
|
|
protected string $password = ''; |
31
|
|
|
protected string $bucketName = self::DEFAULT_VALUE; |
32
|
|
|
protected string $scopeName = self::DEFAULT_VALUE; |
33
|
|
|
protected string $collectionName = self::DEFAULT_VALUE; |
34
|
|
|
|
35
|
|
|
|
36
|
|
|
public function getHost(): string |
37
|
|
|
{ |
38
|
|
|
return $this->host; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @param string $host |
43
|
|
|
* @return Config |
44
|
|
|
* @throws PhpfastcacheLogicException |
45
|
|
|
*/ |
46
|
|
|
public function setHost(string $host): Config |
47
|
|
|
{ |
48
|
|
|
return $this->setProperty('host', $host); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @return int |
53
|
|
|
*/ |
54
|
|
|
public function getPort() |
55
|
|
|
{ |
56
|
|
|
return $this->port; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @param int $port |
61
|
|
|
* @return Config |
62
|
|
|
* @throws PhpfastcacheLogicException |
63
|
|
|
*/ |
64
|
|
|
public function setPort(int $port): Config |
65
|
|
|
{ |
66
|
|
|
return $this->setProperty('port', $port); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @return string |
71
|
|
|
*/ |
72
|
|
|
public function getUsername(): string |
73
|
|
|
{ |
74
|
|
|
return $this->username; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @param string $username |
79
|
|
|
* @return Config |
80
|
|
|
* @throws PhpfastcacheLogicException |
81
|
|
|
*/ |
82
|
|
|
public function setUsername(string $username): Config |
83
|
|
|
{ |
84
|
|
|
return $this->setProperty('username', $username); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @return string |
89
|
|
|
*/ |
90
|
|
|
public function getPassword(): string |
91
|
|
|
{ |
92
|
|
|
return $this->password; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @param string $password |
97
|
|
|
* @return Config |
98
|
|
|
* @throws PhpfastcacheLogicException |
99
|
|
|
*/ |
100
|
|
|
public function setPassword(string $password): Config |
101
|
|
|
{ |
102
|
|
|
return $this->setProperty('password', $password); |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @return string |
107
|
|
|
*/ |
108
|
|
|
public function getBucketName(): string |
109
|
|
|
{ |
110
|
|
|
return $this->bucketName; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* @param string $bucketName |
115
|
|
|
* @return Config |
116
|
|
|
* @throws PhpfastcacheLogicException |
117
|
|
|
*/ |
118
|
|
|
public function setBucketName(string $bucketName): Config |
119
|
|
|
{ |
120
|
|
|
return $this->setProperty('bucketName', $bucketName); |
121
|
|
|
} |
122
|
|
|
/** |
123
|
|
|
* @return string |
124
|
|
|
*/ |
125
|
|
|
public function getScopeName(): string |
126
|
|
|
{ |
127
|
|
|
return $this->scopeName; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @param string $scopeName |
132
|
|
|
* @return Config |
133
|
|
|
* @throws PhpfastcacheLogicException |
134
|
|
|
*/ |
135
|
|
|
public function setScopeName(string $scopeName): Config |
136
|
|
|
{ |
137
|
|
|
return $this->setProperty('scopeName', $scopeName); |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @return string |
142
|
|
|
*/ |
143
|
|
|
public function getCollectionName(): string |
144
|
|
|
{ |
145
|
|
|
return $this->collectionName; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* @param string $collectionName |
150
|
|
|
* @return Config |
151
|
|
|
* @throws PhpfastcacheLogicException |
152
|
|
|
*/ |
153
|
|
|
public function setCollectionName(string $collectionName): Config |
154
|
|
|
{ |
155
|
|
|
return $this->setProperty('collectionName', $collectionName); |
156
|
|
|
} |
157
|
|
|
} |
158
|
|
|
|