21 namespace Erebot\Config;
58 \Erebot\Interfaces\Config\
Main $mainCfg,
59 \SimpleXMLElement $xml
61 parent::__construct($mainCfg, $xml);
62 $this->maincfg = $mainCfg;
63 $this->servers = array();
64 $this->channels = array();
65 $this->name = (string) $xml[
'name'];
67 foreach ($xml->servers->server as $serverCfg) {
69 $newConfig = new \Erebot\Config\Server($this, $serverCfg);
70 $uris = $newConfig->getConnectionURI();
71 $uri = new \Erebot\URI($uris[count($uris) - 1]);
72 $this->servers[(string) $uri] = $newConfig;
76 if (isset($xml->channels->channel)) {
77 foreach ($xml->channels->channel as $channelCfg) {
79 $newConfig = new \Erebot\Config\Channel($this, $channelCfg);
80 $this->channels[$newConfig->getName()] = $newConfig;
107 if (!isset($this->servers[$server])) {
108 throw new \Erebot\NotFoundException(
'No such server');
110 return $this->servers[$server];
122 if (!isset($this->channels[$channel])) {
123 throw new \Erebot\NotFoundException(
'No such channel');
125 return $this->channels[$channel];
$maincfg
Main configuration this object depends on.
__construct(\Erebot\Interfaces\Config\Main $mainCfg,\SimpleXMLElement $xml)
This class contains the configuration for an IRC network.
$name
The name of this IRC network.
$channels
A list of channel configurations which apply to this network.
Contains the main (general) configuration for Erebot.
$servers
A list of server configurations which apply to this network.
A configuration proxy which cascades settings.