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 ( 5a87e0...fde97e )
by Trevor
03:14
created

BaseApi::getBrowser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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