1 | <?php |
||
8 | class TriggerManager |
||
9 | { |
||
10 | const STRATEGY_AFFIRMATIVE = 'affirmative'; |
||
11 | const STRATEGY_CONSENSUS = 'consensus'; |
||
12 | const STRATEGY_UNANIMOUS = 'unanimous'; |
||
13 | |||
14 | protected $voters = []; |
||
15 | protected $strategy; |
||
16 | protected $allowIfEqualGrantedDeniedDecisions; |
||
17 | protected $allowIfAllAbstainDecisions; |
||
18 | |||
19 | 12 | public function __construct($strategy = self::STRATEGY_AFFIRMATIVE, $allowIfEqualGrantedDeniedDecisions = true, $allowIfAllAbstainDecisions = false) |
|
29 | |||
30 | /** |
||
31 | * Add a new voter to the trigger manager |
||
32 | * |
||
33 | * @param VoterInterface $voter |
||
34 | * |
||
35 | * @return TriggerManager self |
||
36 | */ |
||
37 | 12 | public function addVoter(VoterInterface $voter) |
|
43 | |||
44 | /** |
||
45 | * Decide if the decision manager should be triggered or not |
||
46 | * |
||
47 | * @param string $command |
||
48 | * @param InputInterface $input |
||
49 | * |
||
50 | * @return bool |
||
51 | */ |
||
52 | 12 | public function decide($command, InputInterface $input) |
|
109 | } |
||
110 |