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
Pull Request — master (#5)
by
unknown
02:40
created

LiveStream   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 22
dl 0
loc 42
c 0
b 0
f 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 10 2
A cast() 0 10 1
A create() 0 16 2
1
<?php
2
3
4
namespace ApiVideo\Client\Api;
5
6
7
use ApiVideo\Client\Model\Live;
8
9
class LiveStream extends BaseApi
10
{
11
    public function get($liveStreamId)
12
    {
13
        $response = $this->browser->get("/live-streams/$liveStreamId");
14
        if (!$response->isSuccessful()) {
15
            $this->registerLastError($response);
16
17
            return null;
18
        }
19
20
        return $this->unmarshal($response);
21
    }
22
23
    public function create(array $properties = array())
24
    {
25
        $response = $this->browser->post(
26
            '/live-streams',
27
            array(),
28
            json_encode(
29
                $properties
30
            )
31
        );
32
        if (!$response->isSuccessful()) {
33
            $this->registerLastError($response);
34
35
            return null;
36
        }
37
38
        return $this->unmarshal($response);
39
    }
40
41
    protected function cast(array $data)
42
    {
43
        $live                   = new Live();
44
        $live->liveStreamId     = $data['liveStreamId'];
45
        $live->name             = $data['name'];
46
        $live->record           = $data['record'];
47
        $live->streamKey        = $data['streamKey'];
48
        $live->assets           = $data['assets'];
49
50
        return $live;
51
    }
52
53
}
54