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::resolve()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2.351

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 5
cts 9
cp 0.5556
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 2
crap 2.351
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