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