Failed Conditions
Push — master ( d9377e...587e80 )
by Florent
02:05
created

JWKSetLoader   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 2
dl 0
loc 58
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A add() 0 8 1
A load() 0 4 1
A supports() 0 4 1
A getResolver() 0 3 1
A setResolver() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * The MIT License (MIT)
7
 *
8
 * Copyright (c) 2014-2017 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 Jose\Bundle\KeyManagement\Routing;
15
16
use Symfony\Component\Config\Loader\LoaderInterface;
17
use Symfony\Component\Config\Loader\LoaderResolverInterface;
18
use Symfony\Component\Routing\Route;
19
use Symfony\Component\Routing\RouteCollection;
20
21
/**
22
 * Class JWKSetLoader.
23
 */
24
final class JWKSetLoader implements LoaderInterface
25
{
26
    /**
27
     * @var RouteCollection
28
     */
29
    private $routes;
30
31
    /**
32
     * JWKSetLoader Constructor.
33
     */
34
    public function __construct()
35
    {
36
        $this->routes = new RouteCollection();
37
    }
38
39
    /**
40
     * @param string $pattern
41
     * @param string $name
42
     */
43
    public function add(string $pattern, string $name)
44
    {
45
        $controller_id = sprintf('%s:getAction', $name);
46
47
        $defaults = ['_controller' => $controller_id];
48
        $route = new Route($pattern, $defaults);
49
        $this->routes->add(sprintf('jwkset_%s', $name), $route);
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55
    public function load($resource, $type = null)
56
    {
57
        return $this->routes;
58
    }
59
60
    /**
61
     * {@inheritdoc}
62
     */
63
    public function supports($resource, $type = null)
64
    {
65
        return 'jwkset' === $type;
66
    }
67
68
    /**
69
     * {@inheritdoc}
70
     */
71
    public function getResolver()
72
    {
73
    }
74
75
    /**
76
     * {@inheritdoc}
77
     */
78
    public function setResolver(LoaderResolverInterface $resolver)
79
    {
80
    }
81
}
82