@@ -86,17 +86,13 @@ private function decideAffirmative(TokenInterface $token, array $attributes, $ob
86
86
$ deny = 0 ;
87
87
foreach ($ this ->voters as $ voter ) {
88
88
$ result = $ this ->vote ($ voter , $ token , $ object , $ attributes );
89
- switch ($ result ) {
90
- case VoterInterface::ACCESS_GRANTED :
91
- return true ;
92
89
93
- case VoterInterface::ACCESS_DENIED :
94
- ++$ deny ;
95
-
96
- break ;
90
+ if (VoterInterface::ACCESS_GRANTED === $ result ) {
91
+ return true ;
92
+ }
97
93
98
- default :
99
- break ;
94
+ if (VoterInterface:: ACCESS_DENIED === $ result ) {
95
+ ++ $ deny ;
100
96
}
101
97
}
102
98
@@ -128,16 +124,10 @@ private function decideConsensus(TokenInterface $token, array $attributes, $obje
128
124
foreach ($ this ->voters as $ voter ) {
129
125
$ result = $ this ->vote ($ voter , $ token , $ object , $ attributes );
130
126
131
- switch ($ result ) {
132
- case VoterInterface::ACCESS_GRANTED :
133
- ++$ grant ;
134
-
135
- break ;
136
-
137
- case VoterInterface::ACCESS_DENIED :
138
- ++$ deny ;
139
-
140
- break ;
127
+ if (VoterInterface::ACCESS_GRANTED === $ result ) {
128
+ ++$ grant ;
129
+ } elseif (VoterInterface::ACCESS_DENIED === $ result ) {
130
+ ++$ deny ;
141
131
}
142
132
}
143
133
@@ -169,17 +159,12 @@ private function decideUnanimous(TokenInterface $token, array $attributes, $obje
169
159
foreach ($ attributes as $ attribute ) {
170
160
$ result = $ this ->vote ($ voter , $ token , $ object , [$ attribute ]);
171
161
172
- switch ($ result ) {
173
- case VoterInterface::ACCESS_GRANTED :
174
- ++$ grant ;
175
-
176
- break ;
177
-
178
- case VoterInterface::ACCESS_DENIED :
179
- return false ;
162
+ if (VoterInterface::ACCESS_DENIED === $ result ) {
163
+ return false ;
164
+ }
180
165
181
- default :
182
- break ;
166
+ if (VoterInterface:: ACCESS_GRANTED === $ result ) {
167
+ ++ $ grant ;
183
168
}
184
169
}
185
170
}
0 commit comments