PageRenderTime 63ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/system/library/config.php

https://bitbucket.org/jjasko/opencart_serbian
PHP | 32 lines | 25 code | 7 blank | 0 comment | 2 complexity | 4576af83d4059ca69bc025b691056a8a MD5 | raw file
  1. <?php
  2. final class Config {
  3. private $data = array();
  4. public function get($key) {
  5. return (isset($this->data[$key]) ? $this->data[$key] : null);
  6. }
  7. public function set($key, $value) {
  8. $this->data[$key] = $value;
  9. }
  10. public function has($key) {
  11. return isset($this->data[$key]);
  12. }
  13. public function load($filename) {
  14. $file = DIR_CONFIG . $filename . '.php';
  15. if (file_exists($file)) {
  16. $cfg = array();
  17. require($file);
  18. $this->data = array_merge($this->data, $cfg);
  19. } else {
  20. trigger_error('Error: Could not load config ' . $filename . '!');
  21. exit();
  22. }
  23. }
  24. }
  25. ?>