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

SimpleReceiverResolver::resolve()   B

Complexity

Conditions 5
Paths 6

Size

Total Lines 21
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 6.3183

Importance

Changes 0
Metric Value
dl 0
loc 21
ccs 10
cts 16
cp 0.625
rs 8.7624
c 0
b 0
f 0
cc 5
eloc 10
nc 6
nop 2
crap 6.3183
1
<?php
2
3
namespace Bernard\Router;
4
5
use Bernard\Envelope;
6
use Bernard\Receiver;
7
8
/**
9
 * SimpleReceiverResolver supports various receiver inputs, like classes objects and callables.
10
 */
11
class SimpleReceiverResolver implements ReceiverResolver
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16 3
    public function accepts($receiver)
17
    {
18 3
        return is_callable($receiver) || is_object($receiver) || class_exists($receiver);
19
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24 11
    public function resolve($receiver, Envelope $envelope)
25
    {
26 11
        if (null === $receiver) {
27 1
            return null;
28
        }
29
30 10
        if ($receiver instanceof Receiver) {
31 2
            return $receiver;
32
        }
33
34 8
        if (is_callable($receiver) == false) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
35 6
            $receiver = [$receiver, lcfirst($envelope->getName())];
36 6
        }
37
38
        // Receiver is still not a callable which means it's not a valid receiver.
39 8
        if (is_callable($receiver) == false) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
40
            return null;
41
        }
42
43 8
        return new Receiver\CallableReceiver($receiver);
44
    }
45
}
46