1 | <?php |
||
9 | class ConfigBuilder |
||
10 | { |
||
11 | /** |
||
12 | * @var string |
||
13 | */ |
||
14 | private $user = ''; |
||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | private $host = 'localhost'; |
||
19 | /** |
||
20 | * @var int |
||
21 | */ |
||
22 | private $port = 3306; |
||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | private $password = ''; |
||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private $charset = 'utf8'; |
||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | private $gtid = ''; |
||
35 | /** |
||
36 | * @var int |
||
37 | */ |
||
38 | private $slaveId = 666; |
||
39 | /** |
||
40 | * @var string |
||
41 | */ |
||
42 | private $binLogFileName = ''; |
||
43 | /** |
||
44 | * @var int |
||
45 | */ |
||
46 | private $binLogPosition = 0; |
||
47 | /** |
||
48 | * @var array |
||
49 | */ |
||
50 | private $eventsOnly = []; |
||
51 | /** |
||
52 | * @var array |
||
53 | */ |
||
54 | private $eventsIgnore = []; |
||
55 | /** |
||
56 | * @var array |
||
57 | */ |
||
58 | private $tablesOnly = []; |
||
59 | /** |
||
60 | * @var array |
||
61 | */ |
||
62 | private $databasesOnly = []; |
||
63 | /** |
||
64 | * @var string |
||
65 | */ |
||
66 | private $mariaDbGtid = ''; |
||
67 | /** |
||
68 | * @var int |
||
69 | */ |
||
70 | private $tableCacheSize = 128; |
||
71 | /** |
||
72 | * @var array |
||
73 | */ |
||
74 | private $custom = []; |
||
75 | /** |
||
76 | * @var int |
||
77 | */ |
||
78 | private $heartbeatPeriod = 0; |
||
79 | |||
80 | /** |
||
81 | * @param string $user |
||
82 | * @return ConfigBuilder |
||
83 | */ |
||
84 | 54 | public function withUser($user) |
|
90 | |||
91 | /** |
||
92 | * @param string $host |
||
93 | * @return ConfigBuilder |
||
94 | */ |
||
95 | 54 | public function withHost($host) |
|
101 | |||
102 | /** |
||
103 | * @param int $port |
||
104 | * @return ConfigBuilder |
||
105 | */ |
||
106 | public function withPort($port) |
||
112 | |||
113 | /** |
||
114 | * @param string $password |
||
115 | * @return ConfigBuilder |
||
116 | */ |
||
117 | 54 | public function withPassword($password) |
|
123 | |||
124 | /** |
||
125 | * @param string $charset |
||
126 | * @return ConfigBuilder |
||
127 | */ |
||
128 | public function withCharset($charset) |
||
134 | |||
135 | /** |
||
136 | * @param string $gtid |
||
137 | * @return ConfigBuilder |
||
138 | */ |
||
139 | public function withGtid($gtid) |
||
145 | |||
146 | /** |
||
147 | * @param int $slaveId |
||
148 | * @return ConfigBuilder |
||
149 | */ |
||
150 | public function withSlaveId($slaveId) |
||
156 | |||
157 | /** |
||
158 | * @param string $binLogFileName |
||
159 | * @return ConfigBuilder |
||
160 | */ |
||
161 | public function withBinLogFileName($binLogFileName) |
||
167 | |||
168 | /** |
||
169 | * @param int $binLogPosition |
||
170 | * @return ConfigBuilder |
||
171 | */ |
||
172 | public function withBinLogPosition($binLogPosition) |
||
178 | |||
179 | /** |
||
180 | * @see ConstEventType |
||
181 | * @param array $eventsOnly |
||
182 | * @return ConfigBuilder |
||
183 | */ |
||
184 | 3 | public function withEventsOnly(array $eventsOnly) |
|
190 | |||
191 | /** |
||
192 | * @see ConstEventType |
||
193 | * @param array $eventsIgnore |
||
194 | * @return ConfigBuilder |
||
195 | */ |
||
196 | 54 | public function withEventsIgnore(array $eventsIgnore) |
|
202 | |||
203 | /** |
||
204 | * @param array $tablesOnly |
||
205 | * @return ConfigBuilder |
||
206 | */ |
||
207 | 1 | public function withTablesOnly(array $tablesOnly) |
|
213 | |||
214 | /** |
||
215 | * @param array $databasesOnly |
||
216 | * @return ConfigBuilder |
||
217 | */ |
||
218 | public function withDatabasesOnly(array $databasesOnly) |
||
224 | |||
225 | /** |
||
226 | * @param string $mariaDbGtid |
||
227 | * @return ConfigBuilder |
||
228 | */ |
||
229 | public function withMariaDbGtid($mariaDbGtid) |
||
235 | |||
236 | /** |
||
237 | * @param int $tableCacheSize |
||
238 | * @return $this |
||
239 | */ |
||
240 | public function withTableCacheSize($tableCacheSize) |
||
246 | |||
247 | /** |
||
248 | * @param array $custom |
||
249 | * @return $this |
||
250 | */ |
||
251 | public function withCustom(array $custom) |
||
257 | |||
258 | /** |
||
259 | * @see https://dev.mysql.com/doc/refman/5.6/en/change-master-to.html |
||
260 | * @param int $heartbeatPeriod |
||
261 | * @return $this |
||
262 | */ |
||
263 | public function withHeartbeatPeriod($heartbeatPeriod) |
||
269 | |||
270 | /** |
||
271 | * @return Config |
||
272 | */ |
||
273 | 54 | public function build() |
|
295 | } |