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.

EmailValidation   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 42.86%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 33
ccs 3
cts 7
cp 0.4286
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 3 1
A parse() 0 3 1
A isOk() 0 3 1
1
<?php
2
3
namespace NStack\Models;
4
5
/**
6
 * Class EmailValidation
7
 *
8
 * @package NStack\Models
9
 * @author  Tiago Araujo <[email protected]>
10
 */
11
class EmailValidation extends Model
12
{
13
    /** @var boolean */
14
    protected $ok;
15
16
    /**
17
     * parse
18
     *
19
     * @param array $data
20
     * @author Tiago Araujo <[email protected]>
21
     */
22 1
    public function parse(array $data)
23
    {
24 1
        $this->ok = (int)$data['ok'];
0 ignored issues
show
Documentation Bug introduced by
The property $ok was declared of type boolean, but (int)$data['ok'] is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
25 1
    }
26
27
    /**
28
     * toArray
29
     *
30
     * @return array
31
     * @author Tiago Araujo <[email protected]>
32
     */
33
    public function toArray(): array
34
    {
35
        return ['ok' => $this->ok];
36
    }
37
38
    /**
39
     * @return bool
40
     */
41
    public function isOk(): bool
42
    {
43
        return $this->ok;
44
    }
45
}