protected function aggregateStatistics(array $hosts = array())
{
$result = array();
$statistics = array();
// Passed host(s) to this method
foreach ($hosts as $host) {
$currentHost = explode(':', $host);
$client = $this->getMemcachedClient($currentHost[0], $currentHost[1], $this->getConfig()->timeout);
$statistics[$host] = $client->stats();
}
// Calculate sums for cluster statistics
foreach ($statistics as $host => $statistics) {
foreach ($statistics as $key => $value) {
if (isset($result[$key]) === false) {
$result[$key] = 0;
}
$value = $this->castAsPhpType($value);
if (is_double($value) || is_int($value)) {
$result[$key] += $value;
} else {
$result[$key] = $value;
}
}
}
return $result;
}