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
05:57
created

ValidationException::__construct()   B

Complexity

Conditions 5
Paths 4

Size

Total Lines 18
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 5.3906

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 12
cts 16
cp 0.75
rs 8.8571
c 0
b 0
f 0
cc 5
eloc 13
nc 4
nop 3
crap 5.3906
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 2
    public function __construct($status, $errors, array $lastOptions = [])
12
    {
13 2
        parent::__construct($status, $errors, $lastOptions);
14 2
        $message = "Erros de validação foram encontrados!";
15 2
        $firstError = reset($errors);
16 2
        if(isset($firstError->id) && $firstError->id='invalid_parameter'){
17 2
            switch ($firstError->parameter){
18 2
                case 'card_number':
19
                    $message = "Número de cartão de crédito inválido";
20
                    break;
21 2
                case 'card_expiration':
22
                    $message =  "Data de validade do cartão inválida";
23
                    break;
24 2
            }
25 2
        }
26
27 2
        $this->message = $message;
28 2
    }
29
}
30