| @@ 51-59 (lines=9) @@ | ||
| 48 | ||
| 49 | $this->type = $clientConfig['type']; |
|
| 50 | unset($clientConfig['type']); |
|
| 51 | if (!isset(self::$supportedTypes[$this->type])) { |
|
| 52 | $supportedKeys = array_keys(self::$supportedTypes); |
|
| 53 | sort($supportedKeys); |
|
| 54 | throw new InvalidConfigurationException(sprintf('sludio_helper_captcha_client.clients config "type" key "%s" is not supported. Supported: %s', $this->type, implode(', ', $supportedKeys))); |
|
| 55 | } |
|
| 56 | ||
| 57 | if (!in_array($this->type, $this->usedTypes)) { |
|
| 58 | $this->usedTypes[] = $this->type; |
|
| 59 | } else { |
|
| 60 | throw new InvalidConfigurationException(sprintf('sludio_helper_captcha_client.clients config "type" key "%s" is already in use. Only one occurence by type is allowed', $this->type)); |
|
| 61 | } |
|
| 62 | ||
| @@ 131-139 (lines=9) @@ | ||
| 128 | ||
| 129 | $this->type = $clientConfig['type']; |
|
| 130 | unset($clientConfig['type']); |
|
| 131 | if (!isset(self::$supportedProviderTypes[$this->type])) { |
|
| 132 | $supportedKeys = array_keys(self::$supportedProviderTypes); |
|
| 133 | sort($supportedKeys); |
|
| 134 | throw new InvalidConfigurationException(sprintf('The "sludio_helper_oauth_client.clients" config "type" key "%s" is not supported. We support: %s', $this->type, implode(', ', $supportedKeys))); |
|
| 135 | } |
|
| 136 | ||
| 137 | $node = $tree->root('sludio_helper_oauth_client/clients/'.$key); |
|
| 138 | $this->buildClientConfiguration($node); |
|
| 139 | $config = $processor->process($tree->buildTree(), [$clientConfig]); |
|
| 140 | ||
| 141 | $configurator = $this->getConfigurator($this->type); |
|
| 142 | ||