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 (#26)
by
unknown
14:23
created

ValidationException::__construct()   B

Complexity

Conditions 6
Paths 5

Size

Total Lines 23
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 23
ccs 4
cts 4
cp 1
rs 8.5906
c 0
b 0
f 0
cc 6
eloc 16
nc 5
nop 3
crap 6
1
<?php namespace Vindi\Exceptions;
2
3
class ValidationException extends RequestException
4
{
5
    /**
6
     * ValidationException constructor.
7
     *
8
     * @param int   $status
9
     * @param mixed $errors
10
     */
11 4
    public function __construct($status, $errors, array $lastOptions = [])
12
    {
13 4
        if (ERROR_LOG) {
14
            var_dump($errors);
0 ignored issues
show
Security Debugging Code introduced by
var_dump($errors); looks like debug code. Are you sure you do not want to remove it? This might expose sensitive data.
Loading history...
15 4
            exit;
0 ignored issues
show
Coding Style Compatibility introduced by
The method __construct() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
16 4
        }
17
        
18
        parent::__construct($status, $errors, $lastOptions);
19
        $message = "Erros de validação foram encontrados!";
20
        $firstError = reset($errors);
21
        if(isset($firstError->id) && $firstError->id='invalid_parameter'){
22
            switch ($firstError->parameter){
23
                case 'card_number':
24
                    $message = "Número de cartão de crédito inválido";
25
                    break;
26
                case 'card_expiration':
27
                    $message =  "Data de validade do cartão inválida";
28
                    break;
29
            }
30
        }
31
32
        $this->message = $message;
33
    }
34
}
35