/**
* Returns a string message, giving insights what happened during privilege evaluation.
*
* @param string $privilegeReasonMessage
* @return string
*/
protected function renderDecisionReasonMessage($privilegeReasonMessage)
{
if (count($this->securityContext->getRoles()) === 0) {
$rolesMessage = 'No authenticated roles';
} else {
$rolesMessage = 'Authenticated roles: ' . implode(', ', array_keys($this->securityContext->getRoles()));
}
return sprintf('Access denied for method' . chr(10) . 'Method: %s::%s()' . chr(10) . chr(10) . '%s' . chr(10) . chr(10) . '%s', $this->joinPoint->getClassName(), $this->joinPoint->getMethodName(), $privilegeReasonMessage, $rolesMessage);
}