Failed Conditions
Push — v7 ( 477009...5356df )
by Florent
03:33
created

JWKSetLoader::setResolver()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * The MIT License (MIT)
5
 *
6
 * Copyright (c) 2014-2016 Spomky-Labs
7
 *
8
 * This software may be modified and distributed under the terms
9
 * of the MIT license.  See the LICENSE file for details.
10
 */
11
12
namespace Jose\Bundle\JoseFramework\Routing;
13
14
use Symfony\Component\Config\Loader\LoaderInterface;
15
use Symfony\Component\Config\Loader\LoaderResolverInterface;
16
use Symfony\Component\Routing\Route;
17
use Symfony\Component\Routing\RouteCollection;
18
19
final class JWKSetLoader implements LoaderInterface
20
{
21
    /**
22
     * @var RouteCollection
23
     */
24
    private $routes;
25
26
    /**
27
     * JWKSetLoader Constructor.
28
     */
29
    public function __construct()
30
    {
31
        $this->routes = new RouteCollection();
32
    }
33
34
    /**
35
     * @param string $pattern
36
     * @param string $name
37
     */
38
    public function add(string $pattern, string $name)
39
    {
40
        $controller_id = sprintf('jose.controller.%s', $name);
41
42
        $defaults =['_controller' => $controller_id];
43
        $route = new Route($pattern, $defaults);
44
        $this->routes->add(sprintf('jwkset_%s', $name), $route);
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function load($resource, $type = null)
51
    {
52
        return $this->routes;
53
    }
54
55
    /**
56
     * {@inheritdoc}
57
     */
58
    public function supports($resource, $type = null)
59
    {
60
        return 'jwkset' === $type;
61
    }
62
63
    /**
64
     * {@inheritdoc}
65
     */
66
    public function getResolver()
67
    {
68
    }
69
70
    /**
71
     * {@inheritdoc}
72
     */
73
    public function setResolver(LoaderResolverInterface $resolver)
74
    {
75
    }
76
}
77