| 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 | 19 | private function load($key) |
|
| 32 | |||
| 33 | /** |
||
| 34 | * @return array |
||
| 35 | */ |
||
| 36 | 30 | public function getData() |
|
| 40 | |||
| 41 | /** |
||
| 42 | * @param array $data |
||
| 43 | */ |
||
| 44 | 30 | public function setData(array $data) |
|
| 48 | |||
| 49 | /** |
||
| 50 | * @param $fileName |
||
| 51 | * |
||
| 52 | * @return mixed |
||
| 53 | */ |
||
| 54 | 30 | public function get($fileName) |
|
| 65 | |||
| 66 | /** |
||
| 67 | * Return value for the key in the file content. |
||
| 68 | * |
||
| 69 | * @param $fileName |
||
| 70 | * @param $key |
||
| 71 | * @param array $replacements |
||
| 72 | * |
||
| 73 | * @throws \Exception |
||
| 74 | * |
||
| 75 | * @return mixed |
||
| 76 | */ |
||
| 77 | 5 | public function getValueByKey($fileName, $key, $replacements = []) |
|
| 89 | } |
||
| 90 |