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 ( 630c65...3ac260 )
by Trevor
02:45
created

Account::cast()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 17
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace ApiVideo\Client\Api;
4
5
use ApiVideo\Client\Model\Account as AccountModel;
6
use ApiVideo\Client\Model\Quota;
7
use ApiVideo\Client\Model\Term;
8
use DateTimeImmutable;
9
use Exception;
10
11
class Account extends BaseApi
12
{
13
14
    /**
15
     * @return AccountModel|null
16
     */
17
    public function get()
18
    {
19
        $response = $this->browser->get('/account');
20
        if (!$response->isSuccessful()) {
21
            $this->registerLastError($response);
22
23
            return null;
24
        }
25
26
        return $this->unmarshal($response);
27
    }
28
29
30
    /**
31
     * @param array $data
32
     * @return AccountModel
33
     * @throws Exception
34
     */
35
    protected function cast(array $data)
36
    {
37
        $account = new AccountModel();
38
39
        $quota                 = new Quota();
40
        $quota->quotaUsed      = $data['quota']['quotaUsed'];
41
        $quota->quotaRemaining = $data['quota']['quotaRemaining'];
42
        $quota->quotaTotal     = $data['quota']['quotaTotal'];
43
44
        $term          = new Term();
45
        $term->startAt = new DateTimeImmutable($data['startAt']);
0 ignored issues
show
Documentation Bug introduced by
It seems like new DateTimeImmutable($data['startAt']) of type DateTimeImmutable is incompatible with the declared type DateTime of property $startAt.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
46
        $term->endAt   = new DateTimeImmutable($data['endAt']);
0 ignored issues
show
Documentation Bug introduced by
It seems like new DateTimeImmutable($data['endAt']) of type DateTimeImmutable is incompatible with the declared type DateTime of property $endAt.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
47
48
        $account->quota = $quota;
49
        $account->term  = $term;
50
51
        return $account;
52
    }
53
}
54