| @@ 229-251 (lines=23) @@ | ||
| 226 | throw $e; |
|
| 227 | } |
|
| 228 | return true; |
|
| 229 | case self::MODE_NONE: |
|
| 230 | // There must be no overlap between any of the array values |
|
| 231 | ||
| 232 | foreach ($auth as $set => $values) { |
|
| 233 | if (isset($attr[$set]) && count( |
|
| 234 | array_intersect( |
|
| 235 | (array)$attr[$set], |
|
| 236 | $values |
|
| 237 | ) |
|
| 238 | ) |
|
| 239 | ) { |
|
| 240 | $e->addReason(new Reason( |
|
| 241 | $set, |
|
| 242 | (array)($attr[$set] ?? []), |
|
| 243 | $values |
|
| 244 | )); |
|
| 245 | } |
|
| 246 | } |
|
| 247 | ||
| 248 | if ($e->hasReasons()) { |
|
| 249 | throw $e; |
|
| 250 | } |
|
| 251 | return true; |
|
| 252 | case self::MODE_OR: |
|
| 253 | // At least one match must be present |
|
| 254 | foreach ($auth as $set => $values) { |
|
| @@ 252-271 (lines=20) @@ | ||
| 249 | throw $e; |
|
| 250 | } |
|
| 251 | return true; |
|
| 252 | case self::MODE_OR: |
|
| 253 | // At least one match must be present |
|
| 254 | foreach ($auth as $set => $values) { |
|
| 255 | if (isset($attr[$set]) && count( |
|
| 256 | array_intersect( |
|
| 257 | (array)$attr[$set], |
|
| 258 | $values |
|
| 259 | ) |
|
| 260 | ) |
|
| 261 | ) { |
|
| 262 | return true; |
|
| 263 | } |
|
| 264 | $e->addReason(new Reason( |
|
| 265 | $set, |
|
| 266 | (array)($attr[$set] ?? []), |
|
| 267 | $values |
|
| 268 | )); |
|
| 269 | } |
|
| 270 | ||
| 271 | throw $e; |
|
| 272 | default: |
|
| 273 | throw new \InvalidArgumentException('Durrrr'); |
|
| 274 | } |
|