| Total Complexity | 7 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| 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 | $urlParams = $authentication[$urlId]; |
||
| 28 | } elseif (isset($authentication['default'])) { |
||
| 29 | $urlParams = $authentication['default']; |
||
| 30 | } else { |
||
| 31 | throw new InvalidArgumentException('Invalid access URL configuration'); |
||
| 32 | } |
||
| 33 | |||
| 34 | if (!isset($urlParams[$providerName])) { |
||
| 35 | throw new InvalidArgumentException('Invalid authentication provider for access URL'); |
||
| 36 | } |
||
| 37 | |||
| 38 | return $urlParams[$providerName]; |
||
| 39 | } |
||
| 40 | |||
| 41 | public function isEnabled(string $methodName, ?AccessUrl $url = null): bool |
||
| 46 | } |
||
| 47 | } |
||
| 48 |