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.

BaseApi::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace ApiVideo\Client\Api;
4
5
use ApiVideo\Client\Buzz\OAuthBrowser;
6
use ApiVideo\Client\Model\Account as AccountModel;
7
use ApiVideo\Client\Model\Analytic\PlayerSession;
8
use ApiVideo\Client\Model\Caption;
9
use ApiVideo\Client\Model\Chapter;
10
use ApiVideo\Client\Model\Live;
11
use ApiVideo\Client\Model\Player;
12
use ApiVideo\Client\Model\Video;
13
use Buzz\Message\MessageInterface;
14
use Buzz\Message\Response;
15
16
abstract class BaseApi
17
{
18
    /** @var array */
19
    private $lastError;
20
21
    /** @var OAuthBrowser */
22
    protected $browser;
23
24
    /**
25
     * @param OAuthBrowser $browser
26
     */
27
    public function __construct(OAuthBrowser $browser)
28
    {
29
        $this->browser = $browser;
30
    }
31
32
    public function getLastError()
33
    {
34
        return $this->lastError;
35
    }
36
37
    public function getBrowser()
38
    {
39
        return $this->browser;
40
    }
41
42
    protected function registerLastError(Response $response)
43
    {
44
        $this->lastError = array(
45
            'status'  => $response->getStatusCode(),
46
            'message' => json_decode($response->getContent(), true),
47
        );
48
    }
49
50
    /**
51
     * @param MessageInterface $message
52
     * @return Caption|Chapter|Player|Video|Live|PlayerSession|AccountModel
53
     */
54
    protected function unmarshal(MessageInterface $message)
55
    {
56
        return $this->cast(json_decode($message->getContent(), true));
57
    }
58
59
    /**
60
     * @param array $collection
61
     * @return Caption[]|Chapter[]|Players[]|Video[]|Live[]|PlayerSession[]
62
     */
63
    protected function castAll(array $collection)
64
    {
65
        return array_map(array($this, 'cast'), $collection);
66
    }
67
68
    abstract protected function cast(array $data);
69
}
70