1 | <?php |
||
13 | class Config implements ConfigInterface |
||
14 | { |
||
15 | /** |
||
16 | * Array of parameters (with defaults) |
||
17 | * @var array |
||
18 | */ |
||
19 | private $_parameters = [ |
||
20 | 'legacy' => Client::LEGACY, |
||
21 | 'ssl' => Client::SSL, |
||
22 | 'timeout' => Client::TIMEOUT, |
||
23 | 'attempts' => Client::ATTEMPTS, |
||
24 | 'delay' => Client::ATTEMPTS_DELAY |
||
25 | ]; |
||
26 | |||
27 | /** |
||
28 | * Check if key in array |
||
29 | * |
||
30 | * @param string $key |
||
31 | * @param array $array |
||
32 | * @throws Exception |
||
33 | */ |
||
34 | private function keyAllowed(string $key, array $array) |
||
42 | |||
43 | /** |
||
44 | * Set parameter into array |
||
45 | * |
||
46 | * @param string $name |
||
47 | * @param mixed $value |
||
48 | * @return ConfigInterface |
||
49 | * @throws Exception |
||
50 | */ |
||
51 | public function set(string $name, $value): ConfigInterface |
||
69 | |||
70 | /** |
||
71 | * Return port number (get from defaults if port is not set by user) |
||
72 | * |
||
73 | * @param string $parameter |
||
74 | * @return bool|int |
||
75 | */ |
||
76 | private function getPort(string $parameter) |
||
87 | |||
88 | /** |
||
89 | * Remove parameter from array by name |
||
90 | * |
||
91 | * @param string $parameter |
||
92 | * @return ConfigInterface |
||
93 | * @throws Exception |
||
94 | */ |
||
95 | public function delete(string $parameter): ConfigInterface |
||
105 | |||
106 | /** |
||
107 | * Return parameter of current config by name |
||
108 | * |
||
109 | * @param string $parameter |
||
110 | * @return mixed |
||
111 | * @throws Exception |
||
112 | */ |
||
113 | public function get(string $parameter) |
||
120 | |||
121 | /** |
||
122 | * Return array with all parameters of configuration |
||
123 | * |
||
124 | * @return array |
||
125 | */ |
||
126 | public function getParameters(): array |
||
130 | } |
||
131 |