private function loadConfig($xml)
{
if ($xml instanceof TXmlElement) {
foreach ($xml->getElementsByTagName('server') as $serverConfig) {
$properties = $serverConfig->getAttributes();
if (($host = $properties->remove('Host')) === null) {
throw new TConfigurationException('memcache_serverhost_required');
}
if (($port = $properties->remove('Port')) === null) {
throw new TConfigurationException('memcache_serverport_required');
}
if (!is_numeric($port)) {
throw new TConfigurationException('memcache_serverport_invalid');
}
$server = array('Host' => $host, 'Port' => $port, 'Weight' => 1, 'Timeout' => 1800, 'RetryInterval' => 15, 'Persistent' => true);
$checks = array('Weight' => 'memcache_serverweight_invalid', 'Timeout' => 'memcache_servertimeout_invalid', 'RetryInterval' => 'memcach_serverretryinterval_invalid');
foreach ($checks as $property => $exception) {
$value = $properties->remove($property);
if ($value !== null && is_numeric($value)) {
$server[$property] = $value;
} else {
if ($value !== null) {
throw new TConfigurationException($exception);
}
}
}
$server['Persistent'] = TPropertyValue::ensureBoolean($properties->remove('Persistent'));
$this->_servers[] = $server;
}
}
}