|
@ -18,6 +18,8 @@ class BaseCfg extends Base |
|
|
$object = new \ReflectionClass($this); |
|
|
$object = new \ReflectionClass($this); |
|
|
$properties = $object->getProperties(); |
|
|
$properties = $object->getProperties(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取类名 -> 去除命名空间 -> 转成全小写
|
|
|
//获取类名 -> 去除命名空间 -> 转成全小写
|
|
|
$className = get_called_class(); |
|
|
$className = get_called_class(); |
|
|
$className = strtolower(array_reverse(explode('\\', $className))[0]); |
|
|
$className = strtolower(array_reverse(explode('\\', $className))[0]); |
|
@ -36,7 +38,6 @@ class BaseCfg extends Base |
|
|
$name = implode(".", array_map('strtolower', StringHelper::camelStrToArray($name))); |
|
|
$name = implode(".", array_map('strtolower', StringHelper::camelStrToArray($name))); |
|
|
|
|
|
|
|
|
$value = $item->getValue($this); |
|
|
$value = $item->getValue($this); |
|
|
|
|
|
|
|
|
if (is_string($value)) { |
|
|
if (is_string($value)) { |
|
|
$ret .= "{$className}.{$name} = \"{$value}\"\n"; |
|
|
$ret .= "{$className}.{$name} = \"{$value}\"\n"; |
|
|
} else if (is_integer($value)) { |
|
|
} else if (is_integer($value)) { |
|
@ -48,8 +49,9 @@ class BaseCfg extends Base |
|
|
$ret .= $value->toString($className); |
|
|
$ret .= $value->toString($className); |
|
|
} else if(is_null($value)){ |
|
|
} else if(is_null($value)){ |
|
|
$ret .= "{$className}.{$name} = \"null\"\n"; |
|
|
$ret .= "{$className}.{$name} = \"null\"\n"; |
|
|
} else |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
} else if(is_float($value)){ |
|
|
|
|
|
$ret .= "{$className}.{$name} = {$value}\n"; |
|
|
|
|
|
}else{ |
|
|
$ret .= "{$className}.{$name} = \"unknow type\"\n"; |
|
|
$ret .= "{$className}.{$name} = \"unknow type\"\n"; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|