function import(DOMDocument $doc, $commitChannels = true)
{
$this->doc = $doc;
$count = 0;
$exception = null;
$timer = microtime(1);
try {
foreach ($doc->getElementsByTagName('channel') as $channel) {
if ($channel->nodeType !== XML_ELEMENT_NODE) {
continue;
}
$this->importChannel($channel, $commitChannels);
$count++;
}
} catch (Exception $e) {
$exception = $e;
}
if ($exception !== null) {
throw $exception;
}
$timer = microtime(1) - $timer;
$this->report('Imported ' . counted($count, 'channel', 'channels', 'zero', 'one') . ' in ' . gb_format_duration($timer));
}