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 ( cb8968...43f345 )
by Márk
03:35
created

ContainerReceiverResolver   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 58.81%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 34
ccs 10
cts 17
cp 0.5881
rs 10
c 0
b 0
f 0

3 Methods

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