private function loadCacheLifetime($path, \DOMXPath $xpath)
{
$nodeList = $xpath->query($path);
if (!$nodeList->length) {
return ['type' => CacheLifetimeResolverInterface::TYPE_SECONDS, 'value' => 0];
}
// get first node
$node = $nodeList->item(0);
$type = $node->getAttribute('type');
if ('' === $type) {
$type = CacheLifetimeResolverInterface::TYPE_SECONDS;
}
$value = $node->nodeValue;
if (!$this->cacheLifetimeResolver->supports($type, $value)) {
throw new \InvalidArgumentException(sprintf('CacheLifetime "%s" with type "%s" not supported.', $value, $type));
}
return ['type' => $type, 'value' => $value];
}