public function getBool($sec, $key, $default = null)
{
if (null === $this->sections && null === $default) {
throw new Config_Lite_Exception_Runtime('configuration seems to be empty (no sections),' . 'and no default value given.');
}
if (null === $sec) {
if (array_key_exists($key, $this->sections)) {
if (empty($this->sections[$key])) {
return false;
}
$value = strtolower($this->sections[$key]);
if (!in_array($value, $this->_booleans) && null === $default) {
throw new Config_Lite_Exception_InvalidArgument(sprintf('Not a boolean: %s, and no default value given.', $value));
} else {
return $this->_booleans[$value];
}
}
}
if (array_key_exists($key, $this->sections[$sec])) {
if (empty($this->sections[$sec][$key])) {
return false;
}
$value = strtolower($this->sections[$sec][$key]);
if (!in_array($value, $this->_booleans) && null === $default) {
throw new Config_Lite_Exception_InvalidArgument(sprintf('Not a boolean: %s, and no default value given.', $value));
} else {
return $this->_booleans[$value];
}
}
if (null !== $default) {
return $default;
}
throw new Config_Lite_Exception_UnexpectedValue('option not found, no default value given.');
}