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 ( 967239...06466a )
by Márk
02:52
created

SimpleReceiverResolver   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 60%

Importance

Changes 0
Metric Value
wmc 8
lcom 0
cbo 2
dl 0
loc 35
ccs 12
cts 20
cp 0.6
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A accepts() 0 4 3
A resolve() 0 21 5
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