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   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 14
c 1
b 0
f 0
dl 0
loc 37
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A cast() 0 13 1
A get() 0 10 2
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