protected function getContextKey(ResponseContext $context = null) { if (!$context) { return 'no_context'; } $cacheParts = array(); $values = $context->getAllValues(); ksort($values); foreach ($values as $value) { $cacheParts[] = $value; } return implode('_', $cacheParts); }
/** * Flushes all data to another response context * @param ResponseContext $mainContext */ public function flushToContext(ResponseContext $mainContext) { foreach ($this->getAllValues() as $key => $value) { $mainContext->setValue($key, $value); } foreach ($this->layoutSnippetResponses as $key => $responses) { foreach ($responses as $snippet) { $mainContext->addToLayoutSnippet($key, $snippet); } } }