ConsensusStrategy
in package
implements
AccessDecisionStrategyInterface, Stringable
FinalYes
Grants access if there is consensus of granted against denied responses.
Consensus means majority-rule (ignoring abstains) rather than unanimous agreement (ignoring abstains). If you require unanimity, see UnanimousBased.
If there were an equal number of grant and deny votes, the decision will be based on the allowIfEqualGrantedDeniedDecisions property value (defaults to true).
If all voters abstained from voting, the decision will be based on the allowIfAllAbstainDecisions property value (defaults to false).
Tags
Table of Contents
Interfaces
- AccessDecisionStrategyInterface
- A strategy for turning a stream of votes into a final decision.
- Stringable
Properties
Methods
- __construct() : mixed
- __toString() : string
- decide() : bool
Properties
$allowIfAllAbstainDecisions
private
bool
$allowIfAllAbstainDecisions
$allowIfEqualGrantedDeniedDecisions
private
bool
$allowIfEqualGrantedDeniedDecisions
Methods
__construct()
public
__construct([bool $allowIfAllAbstainDecisions = false ][, bool $allowIfEqualGrantedDeniedDecisions = true ]) : mixed
Parameters
- $allowIfAllAbstainDecisions : bool = false
- $allowIfEqualGrantedDeniedDecisions : bool = true
__toString()
public
__toString() : string
Return values
stringdecide()
public
decide(Traversable $results) : bool
Parameters
- $results : Traversable