public function render($identity, $content = null)
{
if (false === ctype_alnum(preg_replace('/[\\-_]/i', '', $identity))) {
if (true === $identity instanceof DomainObjectInterface) {
$identity = get_class($identity) . self::ID_SEPARATOR . $identity->getUid();
} elseif (true === method_exists($identity, '__toString')) {
$identity = (string) $identity;
} else {
throw new \RuntimeException('Parameter $identity for Render/CacheViewHelper was not a string or a string-convertible object', 1352581782);
}
}
// Hash the cache-key to circumvent disallowed chars
$identity = sha1($identity);
if (true === $this->has($identity)) {
return $this->retrieve($identity);
}
if (null === $content) {
$content = $this->renderChildren();
}
$this->store($content, $identity);
return $content;
}