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.

Account::get()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 10
rs 10
cc 2
nc 2
nop 0
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 Exception;
8
9
class Account extends BaseApi
10
{
11
12
    /**
13
     * @return AccountModel|null
14
     */
15
    public function get()
16
    {
17
        $response = $this->browser->get('/account');
18
        if (!$response->isSuccessful()) {
19
            $this->registerLastError($response);
20
21
            return null;
22
        }
23
24
        return $this->unmarshal($response);
25
    }
26
27
28
    /**
29
     * @param array $data
30
     * @return AccountModel
31
     * @throws Exception
32
     */
33
    protected function cast(array $data)
34
    {
35
        $account = new AccountModel();
36
37
        $quota = new Quota();
38
        $quota->quotaUsed = $data['quota']['quotaUsed'];
39
        $quota->quotaRemaining = $data['quota']['quotaRemaining'];
40
        $quota->quotaTotal = $data['quota']['quotaTotal'];
41
42
        $account->quota = $quota;
43
        $account->features = $data['features'];
44
45
        return $account;
46
    }
47
}
48