@@ -9,8 +9,8 @@ |
||
9 | 9 | */ |
10 | 10 | final class VotingDecisionEnum extends Enum |
11 | 11 | { |
12 | - protected static $values = [ |
|
13 | - 'ALLOWED', |
|
14 | - 'DENIED', |
|
15 | - ]; |
|
12 | + protected static $values = [ |
|
13 | + 'ALLOWED', |
|
14 | + 'DENIED', |
|
15 | + ]; |
|
16 | 16 | } |
@@ -9,64 +9,64 @@ |
||
9 | 9 | class VotingAbilityAwareAssembly extends VotingAssembly implements IVotingAbilityAwareAssembly |
10 | 10 | { |
11 | 11 | |
12 | - /** |
|
13 | - * @var string |
|
14 | - */ |
|
15 | - protected $subjectClassName; |
|
12 | + /** |
|
13 | + * @var string |
|
14 | + */ |
|
15 | + protected $subjectClassName; |
|
16 | 16 | |
17 | - /** |
|
18 | - * @var string |
|
19 | - */ |
|
20 | - protected $contextClassName; |
|
17 | + /** |
|
18 | + * @var string |
|
19 | + */ |
|
20 | + protected $contextClassName; |
|
21 | 21 | |
22 | - /** |
|
23 | - * @var string[] |
|
24 | - */ |
|
25 | - protected $actionList; |
|
22 | + /** |
|
23 | + * @var string[] |
|
24 | + */ |
|
25 | + protected $actionList; |
|
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * @param \SpareParts\Overseer\StrategyEnum $strategy |
|
30 | - * @param IVoter[] $voters |
|
31 | - * @param string|string[] $actions |
|
32 | - * @param string $contextClassName |
|
33 | - * @param string $subjectClassName |
|
34 | - */ |
|
35 | - public function __construct( |
|
36 | - StrategyEnum $strategy, |
|
37 | - array $voters, |
|
38 | - $actions = null, |
|
39 | - $subjectClassName = null, |
|
40 | - $contextClassName = null |
|
41 | - ) { |
|
42 | - parent::__construct($strategy, $voters); |
|
28 | + /** |
|
29 | + * @param \SpareParts\Overseer\StrategyEnum $strategy |
|
30 | + * @param IVoter[] $voters |
|
31 | + * @param string|string[] $actions |
|
32 | + * @param string $contextClassName |
|
33 | + * @param string $subjectClassName |
|
34 | + */ |
|
35 | + public function __construct( |
|
36 | + StrategyEnum $strategy, |
|
37 | + array $voters, |
|
38 | + $actions = null, |
|
39 | + $subjectClassName = null, |
|
40 | + $contextClassName = null |
|
41 | + ) { |
|
42 | + parent::__construct($strategy, $voters); |
|
43 | 43 | |
44 | - $this->actionList = (array) $actions; |
|
45 | - $this->subjectClassName = $subjectClassName; |
|
46 | - $this->contextClassName = $contextClassName; |
|
47 | - } |
|
44 | + $this->actionList = (array) $actions; |
|
45 | + $this->subjectClassName = $subjectClassName; |
|
46 | + $this->contextClassName = $contextClassName; |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | - /** |
|
51 | - * @param string $actionName |
|
52 | - * @param object $subject |
|
53 | - * @param \SpareParts\Overseer\Context\IVotingContext $context |
|
54 | - * @return bool |
|
55 | - */ |
|
56 | - public function canVoteOn($actionName, $subject, IVotingContext $context) |
|
57 | - { |
|
58 | - if ($this->subjectClassName && !($subject instanceof $this->subjectClassName)) { |
|
59 | - return false; |
|
60 | - } |
|
50 | + /** |
|
51 | + * @param string $actionName |
|
52 | + * @param object $subject |
|
53 | + * @param \SpareParts\Overseer\Context\IVotingContext $context |
|
54 | + * @return bool |
|
55 | + */ |
|
56 | + public function canVoteOn($actionName, $subject, IVotingContext $context) |
|
57 | + { |
|
58 | + if ($this->subjectClassName && !($subject instanceof $this->subjectClassName)) { |
|
59 | + return false; |
|
60 | + } |
|
61 | 61 | |
62 | - if ($this->contextClassName && !($context instanceof $this->contextClassName)) { |
|
63 | - return false; |
|
64 | - } |
|
62 | + if ($this->contextClassName && !($context instanceof $this->contextClassName)) { |
|
63 | + return false; |
|
64 | + } |
|
65 | 65 | |
66 | - if ($this->actionList && !in_array($actionName, $this->actionList)) { |
|
67 | - return false; |
|
68 | - } |
|
69 | - return true; |
|
70 | - } |
|
66 | + if ($this->actionList && !in_array($actionName, $this->actionList)) { |
|
67 | + return false; |
|
68 | + } |
|
69 | + return true; |
|
70 | + } |
|
71 | 71 | |
72 | 72 | } |
@@ -12,11 +12,11 @@ |
||
12 | 12 | */ |
13 | 13 | final class StrategyEnum extends Enum |
14 | 14 | { |
15 | - protected static $values = [ |
|
16 | - 'FIRST_VOTE_DECIDES', |
|
17 | - 'ALLOW_UNLESS_DENIED', |
|
18 | - 'DENY_UNLESS_ALLOWED', |
|
19 | - 'EVERYONE_MUST_ALLOW_TO_BE_ALLOWED', |
|
20 | - 'EVERYONE_MUST_DENY_TO_BE_DENIED', |
|
21 | - ]; |
|
15 | + protected static $values = [ |
|
16 | + 'FIRST_VOTE_DECIDES', |
|
17 | + 'ALLOW_UNLESS_DENIED', |
|
18 | + 'DENY_UNLESS_ALLOWED', |
|
19 | + 'EVERYONE_MUST_ALLOW_TO_BE_ALLOWED', |
|
20 | + 'EVERYONE_MUST_DENY_TO_BE_DENIED', |
|
21 | + ]; |
|
22 | 22 | } |