21 namespace Erebot\Config;
30 class Module implements \Erebot\Interfaces\Config\Module
50 $this->name = (string) $xml[
'name'];
51 $this->params = array();
53 isset($xml[
'active']) ?
54 (
string) $xml[
'active'] :
57 $this->active = in_array(
$active, array(
'1',
'true',
'on',
'yes'));
59 foreach ($xml->param as $param) {
60 $prm = (string) $param[
'name'];
61 $val = (string) $param[
'value'];
62 $this->params[$prm] = $val;
79 throw new \Erebot\InvalidValueException(
80 'Invalid activation value'
97 if (!is_string($param)) {
98 throw new \Erebot\InvalidValueException(
'Bad parameter name');
100 if (!isset($this->params[$param])) {
101 throw new \Erebot\NotFoundException(
'No such parameter');
103 return $this->params[$param];
109 return array_keys($this->params);
__construct(\SimpleXMLElement $xml)
$params
A dictionary mapping parameter names to their textual value.
This class stores configuration data about modules.
$name
The name of the module.
$active
A boolean indicating whether the module is active or not.