1 | <?php |
||
11 | class Configuration |
||
12 | { |
||
13 | |||
14 | const SECTION_TYPE_INSTANCE = 'instance'; |
||
15 | |||
16 | const OPTION_UPDATE_INTERVAL = 'updateInterval'; |
||
17 | const OPTION_LISTEN_ADDRESS = 'listenAddress'; |
||
18 | const OPTION_LISTEN_PORT = 'listenPort'; |
||
19 | |||
20 | const DEFAULT_UPDATE_INTERVAL = 1; |
||
21 | const DEFAULT_LISTEN_ADDRESS = '0.0.0.0'; |
||
22 | const DEFAULT_LISTEN_PORT = 9333; |
||
23 | |||
24 | /** |
||
25 | * @var string the database path |
||
26 | */ |
||
27 | private $_databasePath; |
||
28 | |||
29 | /** |
||
30 | * @var string the log file path |
||
31 | */ |
||
32 | private $_logPath; |
||
33 | |||
34 | /** |
||
35 | * @var Instance[] the instances |
||
36 | */ |
||
37 | private $_instances; |
||
38 | |||
39 | /** |
||
40 | * @var float the status update interval (in seconds) |
||
41 | */ |
||
42 | private $_updateInterval = self::DEFAULT_UPDATE_INTERVAL; |
||
43 | |||
44 | /** |
||
45 | * @var string the address to listen on |
||
46 | */ |
||
47 | private $_listenAddress = self::DEFAULT_LISTEN_ADDRESS; |
||
48 | |||
49 | /** |
||
50 | * @var int the port to listen on |
||
51 | */ |
||
52 | private $_listenPort = self::DEFAULT_LISTEN_PORT; |
||
53 | |||
54 | |||
55 | /** |
||
56 | * @param string $databasePath |
||
57 | * @param Instance[] $_instances |
||
58 | */ |
||
59 | public function __construct($databasePath, array $_instances) |
||
64 | |||
65 | |||
66 | /** |
||
67 | * @return string |
||
68 | */ |
||
69 | public function getDatabasePath() |
||
73 | |||
74 | |||
75 | /** |
||
76 | * @return string |
||
77 | */ |
||
78 | public function getLogPath() |
||
82 | |||
83 | |||
84 | /** |
||
85 | * @param string $logPath |
||
86 | */ |
||
87 | public function setLogPath($logPath) |
||
91 | |||
92 | |||
93 | /** |
||
94 | * @return Instance[] |
||
95 | */ |
||
96 | public function getInstances() |
||
100 | |||
101 | |||
102 | /** |
||
103 | * @return float |
||
104 | */ |
||
105 | public function getUpdateInterval() |
||
109 | |||
110 | |||
111 | /** |
||
112 | * @param $updateInterval |
||
113 | * |
||
114 | * @throws \RuntimeException |
||
115 | */ |
||
116 | public function setUpdateInterval($updateInterval) |
||
123 | |||
124 | |||
125 | /** |
||
126 | * @return string |
||
127 | */ |
||
128 | public function getListenAddress() |
||
132 | |||
133 | |||
134 | /** |
||
135 | * @param string $listenAddress |
||
136 | */ |
||
137 | public function setListenAddress($listenAddress) |
||
141 | |||
142 | |||
143 | /** |
||
144 | * @return int |
||
145 | */ |
||
146 | public function getListenPort() |
||
150 | |||
151 | |||
152 | /** |
||
153 | * @param int $listenPort |
||
154 | * |
||
155 | * @throws \RuntimeException |
||
156 | */ |
||
157 | public function setListenPort($listenPort) |
||
164 | |||
165 | } |
||
166 |