Failed Conditions
Push — ng ( f68947...95ea19 )
by Florent
04:36
created

SignedMetadataCompilerPass::process()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 6
nc 2
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * The MIT License (MIT)
7
 *
8
 * Copyright (c) 2014-2018 Spomky-Labs
9
 *
10
 * This software may be modified and distributed under the terms
11
 * of the MIT license.  See the LICENSE file for details.
12
 */
13
14
namespace OAuth2Framework\Bundle\Component\Endpoint\Metadata\Compiler;
15
16
use OAuth2Framework\Bundle\Controller\MetadataController;
17
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
18
use Symfony\Component\DependencyInjection\ContainerBuilder;
19
use Symfony\Component\DependencyInjection\Reference;
20
21
class SignedMetadataCompilerPass implements CompilerPassInterface
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function process(ContainerBuilder $container)
27
    {
28
        if (!$container->hasDefinition(MetadataController::class) || false === $container->getParameter('oauth2_server.endpoint.metadata.signature.enabled')) {
29
            return;
30
        }
31
32
        $signatureAlgorithm = $container->getParameter('oauth2_server.endpoint.metadata.signature.algorithm');
33
        //$keySey = $container->getAlias('oauth2_server.endpoint.metadata.signature.key_set');
0 ignored issues
show
Unused Code Comprehensibility introduced by
64% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
34
        $metadata = $container->getDefinition(MetadataController::class);
35
        $metadata->addMethodCall('enableSignedMetadata', [new Reference('jose.jws_builder.metadata_signature'), $signatureAlgorithm, new Reference('jose.key_set.oauth2_server.key_set.signature')]);
36
    }
37
}
38