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.

RequestException::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 16
CRAP Score 3

Importance

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