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
Pull Request — master (#29)
by
unknown
13:37
created

RequestException::__construct()   B

Complexity

Conditions 5
Paths 9

Size

Total Lines 24
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 16
CRAP Score 5

Importance

Changes 0
Metric Value
dl 0
loc 24
ccs 16
cts 16
cp 1
rs 8.5125
c 0
b 0
f 0
cc 5
eloc 15
nc 9
nop 3
crap 5
1
<?php namespace Vindi\Exceptions;
2
3
use Exception;
4
5
class RequestException extends Exception
6
{
7
    /**
8
     * @var mixed
9
     */
10
    protected $errors;
11
12
    /**
13
     * @var array
14
     */
15
    protected $ids;
16
17
    /**
18
     * @var array
19
     */
20
    protected $parameters;
21
22
    /**
23
     * @var array
24
     */
25
    protected $messages;
26
27
    /**
28
     * @var array
29
     **/
30
    private $lastOptions;
31
32
    /**
33
     * ValidationException constructor.
34
     *
35
     * @param int   $status
36
     * @param mixed $errors
37
     */
38 10
    public function __construct($status, $errors, array $lastOptions = [])
39
    {
40 10
        $this->lastOptions = $lastOptions;
41 10
        $this->errors      = $errors;
42 10
        $this->code        = $status;
43
44 10
        $this->ids        = [];
45 10
        $this->parameters = [];
46 10
        $this->messages   = [];
47
48 10
        foreach ($errors as $error) {
49 10
            if (isset($error->id)) {
50 10
                $this->ids[] = $error->id;
51 10
            }
52 10
            if (isset($error->parameter)) {
53 10
                $this->parameters[] = $error->parameter;
54
            }
55 10
            if (isset($error->message)) {
56 10
                $this->messages[] = $error->message;
57
            }
58
        }
59
60
        $this->message = trim(join('. ', $this->messages));
61 4
    }
62
63 4
    /**
64
     * @return mixed
65
     */
66
    public function getErrors()
67
    {
68
        return $this->errors;
69 4
    }
70
71 4
    /**
72
     * @return array
73
     */
74
    public function getIds()
75
    {
76
        return $this->ids;
77 4
    }
78
79 4
    /**
80
     * @return array
81
     */
82
    public function getParameters()
83
    {
84
        return $this->parameters;
85 4
    }
86
87 4
    /**
88
     * @return array
89
     */
90
    public function getMessages()
91
    {
92
        return $this->messages;
93
    }
94 4
95
    /**
96 4
     * Return the last request body
97
     * @return string
98
     **/
99
    public function getRequestBody()
100
    {
101
        return json_encode($this->lastOptions['json']);
102
    }
103
}
104