/** * @param ContextInterface $context * @param ActionInterface $action * @param array $extraData * @param bool $logWholeContext * * @return array */ private static function getContext(ContextInterface $context, ActionInterface $action = null, array $extraData = null, $logWholeContext = false) { $topContext = $context->getTopParent(); $result = array(); if ($topContext instanceof ProfileContext) { $result['profile_id'] = $topContext->getProfileId(); $result['own_role'] = $topContext->getOwnRole(); } if ($action) { $result['action'] = get_class($action); } $result['top_context_id'] = spl_object_hash($topContext); if ($logWholeContext) { $result['top_context'] = $topContext; } if ($extraData) { $result = array_merge($result, $extraData); } return $result; }