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 ( afc5ea...828b9a )
by Cees-Jan
23:31 queued 06:50
created

Factory::error()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace WyriHaximus\React\ChildProcess\Messenger\Messages;
4
5
use Doctrine\Common\Inflector\Inflector;
6
7
class Factory
8
{
9
    /**
10
     * @param string $line
11
     *
12
     * @throws \Exception
13
     * @return mixed
14
     *
15
     */
16 12
    public static function fromLine($line, array $lineOptions)
17
    {
18 12
        $line = json_decode($line, true);
19 12
        $method = Inflector::camelize($line['type']) . 'FromLine';
20 12
        if (method_exists(get_class(new static()), $method) && $method !== 'FromLine') {
21 11
            return static::$method($line, $lineOptions);
22
        }
23
24 1
        throw new \Exception('Unknown message type: ' . $line['type']);
25
    }
26
27
    /**
28
     * @param array $payload
29
     *
30
     * @return Message
31
     */
32 3
    public static function message(array $payload = [])
33
    {
34 3
        return new Message(new Payload($payload));
35
    }
36
37
    /**
38
     * @param array $payload
39
     *
40
     * @return Error
41
     */
42 3
    public static function error(array $payload = [])
43
    {
44 3
        return new Error(new Payload($payload));
45
    }
46
47
    /**
48
     * @param string $target
49
     * @param array  $payload
50
     * @param mixed  $uniqid
51
     *
52
     * @return Rpc
53
     */
54 6
    public static function rpc($target, array $payload = [], $uniqid = '')
55
    {
56 6
        return new Rpc($target, new Payload($payload), $uniqid);
57
    }
58
59
    /**
60
     * @param string $target
0 ignored issues
show
Bug introduced by
There is no parameter named $target. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
61
     * @param array  $payload
62
     * @param mixed  $uniqid
63
     *
64
     * @return Rpc
65
     */
66 3
    public static function rpcError($uniqid, array $payload = [])
67
    {
68 3
        return new RpcError($uniqid, new Payload($payload));
69
    }
70
71
    /**
72
     * @param string $uniqid
73
     * @param array  $payload
74
     *
75
     * @return RpcSuccess
76
     */
77 3
    public static function rpcSuccess($uniqid, array $payload = [])
78
    {
79 3
        return new RpcSuccess($uniqid, new Payload($payload));
80
    }
81
82
    /**
83
     * @param string $uniqid
84
     * @param array  $payload
85
     *
86
     * @return RpcSuccess
87
     */
88 2
    public static function rpcNotify($uniqid, array $payload = [])
89
    {
90 2
        return new RpcNotify($uniqid, new Payload($payload));
91
    }
92
93
    /**
94
     * @param string $line
95
     * @param array  $lineOptions
96
     *
97
     * @throws \Exception
98
     * @return mixed
99
     *
100
     */
101 1
    protected static function secureFromLine($line, array $lineOptions)
102
    {
103 1
        return SecureLine::fromLine($line, $lineOptions);
104
    }
105
106
    /**
107
     * @param array $line
108
     *
109
     * @return Message
110
     */
111 2
    protected static function messageFromLine(array $line)
112
    {
113 2
        return static::message($line['payload']);
114
    }
115
116
    /**
117
     * @param array $line
118
     *
119
     * @return Error
120
     */
121 1
    protected static function errorFromLine(array $line)
122
    {
123 1
        return static::error($line['payload']);
124
    }
125
126
    /**
127
     * @param array $line
128
     *
129
     * @return Rpc
130
     */
131 4
    protected static function rpcFromLine(array $line)
132
    {
133 4
        return static::rpc($line['target'], $line['payload'], $line['uniqid']);
134
    }
135
136
    /**
137
     * @param array $line
138
     *
139
     * @return Rpc
140
     */
141 1
    protected static function rpcErrorFromLine(array $line)
142
    {
143 1
        return static::rpcError($line['uniqid'], $line['payload']);
144
    }
145
146
    /**
147
     * @param  array      $line
148
     * @return RpcSuccess
149
     */
150 2
    protected static function rpcSuccessFromLine(array $line)
151
    {
152 2
        return static::rpcSuccess($line['uniqid'], $line['payload']);
153
    }
154
155
    /**
156
     * @param  array      $line
157
     * @return RpcSuccess
158
     */
159 1
    protected static function rpcNotifyFromLine(array $line)
160
    {
161 1
        return static::rpcNotify($line['uniqid'], $line['payload']);
162
    }
163
}
164