Conditions | 6 |
Paths | 8 |
Total Lines | 26 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
24 | public function process(ContainerBuilder $container) |
||
25 | { |
||
26 | if (!$container->hasDefinition(PKCEMethodManager::class)) { |
||
27 | return; |
||
28 | } |
||
29 | |||
30 | $definition = $container->getDefinition(PKCEMethodManager::class); |
||
31 | |||
32 | $taggedServices = $container->findTaggedServiceIds('oauth2_server_pkce_method'); |
||
33 | $loaded = []; |
||
34 | foreach ($taggedServices as $id => $tags) { |
||
35 | foreach ($tags as $attributes) { |
||
36 | if (!\array_key_exists('alias', $attributes)) { |
||
37 | throw new \InvalidArgumentException(\Safe\sprintf('The PKCE method "%s" does not have any "alias" attribute.', $id)); |
||
38 | } |
||
39 | $loaded[] = $attributes['alias']; |
||
40 | $definition->addMethodCall('add', [new Reference($id)]); |
||
41 | } |
||
42 | } |
||
43 | |||
44 | if (!$container->hasDefinition(MetadataBuilder::class)) { |
||
45 | return; |
||
46 | } |
||
47 | |||
48 | $definition = $container->getDefinition(MetadataBuilder::class); |
||
49 | $definition->addMethodCall('setCodeChallengeMethodsSupported', [new Reference(PKCEMethodManager::class)]); |
||
50 | } |
||
52 |