1 | <?php |
||
11 | class Dictionary |
||
12 | { |
||
13 | const DICTIONARY_DIR = 'dictionary'; |
||
14 | const DICTIONARY_FILE_SUFFIX = 'json'; |
||
15 | |||
16 | private $data; |
||
17 | |||
18 | /** |
||
19 | * @param $key |
||
20 | * |
||
21 | * @throws \Exception |
||
22 | * |
||
23 | * @return array|mixed |
||
24 | */ |
||
25 | 20 | private function load($key) |
|
32 | |||
33 | /** |
||
34 | * @return array |
||
35 | */ |
||
36 | 31 | public function getData() |
|
40 | |||
41 | /** |
||
42 | * @param array $data |
||
43 | */ |
||
44 | 31 | public function setData(array $data) |
|
48 | |||
49 | /** |
||
50 | * @param string $fileName |
||
51 | * |
||
52 | * @throws \Exception |
||
53 | * |
||
54 | * @return mixed |
||
55 | */ |
||
56 | 31 | public function get(string $fileName) |
|
67 | |||
68 | /** |
||
69 | * Return value for the key in the file content. |
||
70 | * |
||
71 | * @param $fileName |
||
72 | * @param $key |
||
73 | * @param array $replacements |
||
74 | * |
||
75 | * @throws \Exception |
||
76 | * |
||
77 | * @return mixed |
||
78 | */ |
||
79 | 6 | public function getValueByKey(string $fileName, string $key, array $replacements = []) |
|
91 | } |
||
92 |