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.

ApiErrorResponse::__construct()   B
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 23
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 23
rs 8.7972
cc 4
eloc 13
nc 4
nop 3
1
<?php
2
3
/**
4
 * eduVPN - End-user friendly VPN.
5
 *
6
 * Copyright: 2016-2017, The Commons Conservancy eduVPN Programme
7
 * SPDX-License-Identifier: AGPL-3.0+
8
 */
9
10
namespace SURFnet\VPN\Common\Http;
11
12
use InvalidArgumentException;
13
14
class ApiErrorResponse extends Response
15
{
16
    /**
17
     * @param string $wrapperKey
18
     * @param bool   $isOkay
0 ignored issues
show
Bug introduced by
There is no parameter named $isOkay. 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...
19
     * @param mixed  $responseData
0 ignored issues
show
Bug introduced by
There is no parameter named $responseData. 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...
20
     * @param int    $responseCode
21
     */
22
    public function __construct($wrapperKey, $errorMessage, $responseCode = 200)
23
    {
24
        if (!is_string($wrapperKey)) {
25
            throw new InvalidArgumentException('parameter must be string');
26
        }
27
        if (!is_string($errorMessage)) {
28
            throw new InvalidArgumentException('parameter must be string');
29
        }
30
        if (!is_int($responseCode)) {
31
            throw new InvalidArgumentException('parameter must be integer');
32
        }
33
34
        parent::__construct($responseCode, 'application/json');
35
36
        $responseBody = [
37
            $wrapperKey => [
38
                'ok' => false,
39
                'error' => $errorMessage,
40
            ],
41
        ];
42
43
        $this->setBody(json_encode($responseBody));
44
    }
45
}
46