Symfony\Component\Security\Authorization\AccessDecisionManager::decideAffirmative PHP Method

decideAffirmative() protected method

If all voters abstained from voting, the decision will be based on the allowIfAllAbstainDecisions property value (defaults to false).
protected decideAffirmative ( Symfony\Component\Security\Authentication\Token\TokenInterface $token, array $attributes, $object = null )
$token Symfony\Component\Security\Authentication\Token\TokenInterface
$attributes array
    protected function decideAffirmative(TokenInterface $token, array $attributes, $object = null)
    {
        $deny = 0;
        foreach ($this->voters as $voter) {
            $result = $voter->vote($token, $object, $attributes);
            switch ($result) {
                case VoterInterface::ACCESS_GRANTED:
                    return true;

                case VoterInterface::ACCESS_DENIED:
                    ++$deny;

                    break;

                default:
                    break;
            }
        }

        if ($deny > 0) {
            return false;
        }

        return $this->allowIfAllAbstainDecisions;
    }