GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( fa1ad4...6edbd7 )
by Márk
06:40
created

ContainerRouter   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 2
dl 0
loc 38
ccs 0
cts 19
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A get() 0 11 3
A accepts() 0 4 1
1
<?php
2
3
namespace Bernard\Router;
4
use Psr\Container\ContainerExceptionInterface;
5
use Psr\Container\ContainerInterface;
6
use Psr\Container\NotFoundExceptionInterface;
7
8
/**
9
 * PSR-11 container router implementation.
10
 */
11
final class ContainerRouter extends SimpleRouter
12
{
13
    private $container;
14
15
    /**
16
     * @param ContainerInterface $container
17
     * @param array              $receivers
18
     */
19
    public function __construct(ContainerInterface $container, array $receivers = [])
20
    {
21
        $this->container = $container;
22
23
        parent::__construct($receivers);
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    protected function get($name)
30
    {
31
        $serviceId = parent::get($name);
32
        $serviceId = $serviceId ?: '';
33
34
        try {
35
            return $this->container->get($serviceId);
36
        } catch (NotFoundExceptionInterface $e) {
37
            return null;
38
        }
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    protected function accepts($receiver)
45
    {
46
        return $this->container->has($receiver);
47
    }
48
}
49