Source for file Ethna_Config.php
Documentation is available at Ethna_Config.php
// vim: foldmethod=marker
* @author Masaki Fujimoto <fujimoto@php.net>
* @license http://www.opensource.org/licenses/bsd-license.php The BSD License
* @author Masaki Fujimoto <fujimoto@php.net>
/** @var object Ethna_Controller controllerオブジェクト */
* Ethna_Configクラスのコンストラクタ
* @param object Ethna_Controller &$controller controllerオブジェクト
$this->controller =
& $controller;
$r =
$this->_getConfig();
// この時点ではlogging等は出来ない(Loggerオブジェクトが生成されていない)
$fp =
fopen("php://stderr", "r");
fputs($fp, sprintf("error occured while reading config file(s) [%s]\n"), $r->getInfo(0));
$this->controller->fatal();
* @param string $key 設定項目名
function get($key =
null)
if (isset
($this->config[$key]) ==
false) {
return $this->config[$key];
* @param string $key 設定項目名
* @param string $value 設定値
function set($key, $value)
$this->config[$key] =
$value;
* @return mixed 0:正常終了 Ethna_Error:エラー
return $this->_setConfig();
* @return mixed 0:正常終了 Ethna_Error:エラー
$file =
$this->_getConfigFile();
if (isset
($_SERVER['HTTP_HOST']) && isset
($config['url']) ==
false) {
$config['url'] =
sprintf("http://%s/", $_SERVER['HTTP_HOST']);
if (isset
($config['dsn']) ==
false) {
if (isset
($config['log_facility']) ==
false) {
$config['log_facility'] =
"";
if (isset
($config['log_level']) ==
false) {
$config['log_level'] =
"";
if (isset
($config['log_option']) ==
false) {
$config['log_option'] =
"";
* @return mixed 0:正常終了 Ethna_Error:エラー
$file =
$this->_getConfigFile();
fwrite($lh, "\$config = array(\n");
foreach ($this->config as $key =>
$value) {
$this->_setConfigValue($lh, $key, $value, 0);
function _setConfigValue($fp, $key, $value, $level)
foreach ($value as $k =>
$v) {
$this->_setConfigValue($fp, $k, $v, $level+
1);
* @return string 設定ファイルへのフルパス名
function _getConfigFile()
Documentation generated on Fri, 11 Nov 2011 03:59:25 +0900 by phpDocumentor 1.4.3