Total Complexity | 6 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | readonly class AuthenticationConfigHelper |
||
14 | { |
||
15 | public function __construct( |
||
19 | |||
20 | public function getParams(string $providerName, ?AccessUrl $url = null): array |
||
21 | { |
||
22 | $urlId = $url ? $url->getId() : $this->urlHelper->getCurrent()->getId(); |
||
23 | |||
24 | $authentication = $this->parameterBag->get('authentication'); |
||
25 | |||
26 | if (!isset($authentication[$urlId])) { |
||
27 | throw new InvalidArgumentException('Invalid access URL Id'); |
||
28 | } |
||
29 | |||
30 | if (!isset($authentication[$urlId][$providerName])) { |
||
31 | throw new InvalidArgumentException('Invalid authentication source'); |
||
32 | } |
||
33 | |||
34 | return $authentication[$urlId][$providerName]; |
||
35 | } |
||
36 | |||
37 | public function isEnabled(string $methodName, ?AccessUrl $url = null): bool |
||
42 | } |
||
43 | } |
||
44 |