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.
Passed
Push — master ( 579a75...556562 )
by Casper
03:43 queued 01:48
created

File   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Test Coverage

Coverage 51.85%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 38
c 1
b 0
f 0
dl 0
loc 79
rs 10
ccs 14
cts 27
cp 0.5185
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A parse() 0 14 1
A toArray() 0 15 1
1
<?php
2
3
namespace NStack\Models;
4
5
/**
6
 * Class File
7
 *
8
 * @package NStack\Models
9
 * @author  Tiago Araujo <[email protected]>
10
 */
11
class File extends Model
12
{
13
    /** @var int */
14
    protected $id;
15
16
    /** @var string */
17
    protected $name;
18
19
    /** @var string */
20
    protected $tags;
21
22
    /** @var string */
23
    protected $privacy;
24
25
    /** @var string */
26
    protected $goneAt;
27
28
    /** @var string */
29
    protected $mime;
30
31
    /** @var int */
32
    protected $size;
33
34
    /** @var string */
35
    protected $password;
36
37
    /** @var string */
38
    protected $url;
39
40
    /** @var string */
41
    protected $cdnUrl;
42
43
    /** @var string */
44
    protected $showUrl;
45
46
    /** @var string */
47
    protected $downloadUrl;
48
49
    /**
50
     * parse
51
     *
52
     * @param array $data
53
     */
54 2
    public function parse(array $data)
55
    {
56 2
        $this->id           = (int)$data['id'];
57 2
        $this->name         = (string)$data['name'];
58 2
        $this->tags         = (string)$data['tags'];
59 2
        $this->privacy      = (string)$data['privacy'];
60 2
        $this->goneAt       = (string)$data['gone_at'];
61 2
        $this->size         = (string)$data['size'];
0 ignored issues
show
Documentation Bug introduced by
The property $size was declared of type integer, but (string)$data['size'] is of type string. 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...
62 2
        $this->mime         = (string)$data['mime'];
63 2
        $this->password     = (string)$data['password'];
64 2
        $this->url          = (string)$data['url'];
65 2
        $this->cdnUrl       = (string)$data['cdn_url'];
66 2
        $this->showUrl      = (string)$data['show_url'];
67 2
        $this->downloadUrl  = (string)$data['download_url'];
68 2
    }
69
70
    /**
71
     * toArray
72
     *
73
     * @return array
74
     */
75
    public function toArray(): array
76
    {
77
        return [
78
            'id'            => $this->id,
79
            'name'          => $this->name,
80
            'tags'          => $this->tags,
81
            'privacy'       => $this->privacy,
82
            'gone_at'       => $this->goneAt,
83
            'size'          => $this->size,
84
            'password'      => $this->password,
85
            'url'           => $this->url,
86
            'cdn_url'       => $this->cdnUrl,
87
            'show_url'      => $this->showUrl,
88
            'download_url'  => $this->downloadUrl,
89
            'mime'          => $this->mime,
90
        ];
91
    }
92
93
}