source: src/webservice/htdocs/SiWeather/Webservice/WebserviceConfig.php@ db38696

Last change on this file since db38696 was 8c356c1, checked in by Joachim Langenbach <joachim.langenbach@…>, 11 years ago
  • Finished setup
    • Added tests for setup
    • Added translation to setup
  • Property mode set to 100644
File size: 1.7 KB
RevLine 
[8c356c1]1<?php
2/*
3 Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 MA 02110-1301 USA.
19*/
20
21namespace SiWeather\Webservice;
22
23class WebserviceConfig {
24
25 function __construct(){
26 require(__DIR__ ."/../../config/config.php");
27 $this->_config = $config;
28 $this->loadAdditionalConfiguration();
29
30 if($this->getConfig("mode") == "development"){
31 error_reporting(E_ALL);
32 }
33 }
34
35 private function loadAdditionalConfiguration(){
36 $this->_config["dataDirectory"] = "data";
37 }
38
39 public function getConfig($key){
40 if(!array_key_exists($key, $this->_config)){
41 error_log("Expected config value ". $key ." does not exists");
42 return FALSE;
43 }
44
45 if($key == "dataDirectory"){
46// error_log("Use dataDirectory() function to access this value");
47 return $this->dataDirectory();
48 }
49
50 return $this->_config[$key];
51 }
52
53 public function dataDirectory(){
54 return __DIR__ ."/../../". $this->_config["dataDirectory"];
55 }
56
57 private $_config;
58}
59
60?>
Note: See TracBrowser for help on using the repository browser.