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 ( 6ef5d2...d19825 )
by Cees-Jan
08:45 queued 02:16
created

RpcError   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 55
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 0
dl 55
loc 55
ccs 17
cts 17
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 5 5 1
A getPayload() 4 4 1
A jsonSerialize() 8 8 1
A handle() 8 8 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace WyriHaximus\React\ChildProcess\Messenger\Messages;
4
5 View Code Duplication
class RpcError implements \JsonSerializable, ActionableMessageInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
6
{
7
    /**
8
     * @var string
9
     */
10
    protected $uniqid;
11
12
    /**
13
     * @var Payload
14
     */
15
    protected $payload;
16
17
    /**
18
     * @param string $uniqid
19
     * @param Payload $payload
20
     */
21 4
    public function __construct($uniqid, Payload $payload)
22
    {
23 4
        $this->uniqid = $uniqid;
24 4
        $this->payload = $payload;
25 4
    }
26
27
    /**
28
     * @return Payload
29
     */
30 2
    public function getPayload()
31
    {
32 2
        return $this->payload;
33
    }
34
35
    /**
36
     * @return string
37
     */
38 2
    public function jsonSerialize()
39
    {
40
        return [
41 2
            'type' => 'rpc_error',
42 2
            'uniqid' => $this->uniqid,
43 2
            'payload' => $this->payload,
44 2
        ];
45
    }
46
47
    /**
48
     * @param $bindTo
49
     * @param $source
50
     */
51
    public function handle($bindTo, $source)
52
    {
53 1
        $cb = function ($payload, $uniqid) {
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $cb. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
54 1
            $this->getOutstandingCall($uniqid)->reject($payload);
0 ignored issues
show
Bug introduced by
The method getOutstandingCall() does not seem to exist on object<WyriHaximus\React...nger\Messages\RpcError>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
55 1
        };
56 1
        $cb = $cb->bindTo($bindTo);
57 1
        $cb($this->payload, $this->uniqid);
58 1
    }
59
}
60