Ingests   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 4
c 2
b 1
f 0
lcom 0
cbo 2
dl 0
loc 23
ccs 0
cts 18
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 20 4
1
<?php
2
namespace Redbox\Twitch\Resource;
3
use Redbox\Twitch;
4
5
class Ingests extends ResourceAbstract {
6
7
    public function get($args = array())
8
    {
9
        $response = $this->call('get', $args);
10
11
        $ingests = [];
12
13
        if (is_object($response) === true) {
14
            if (isset($response->ingests) === true) {
15
                foreach($response->ingests as $ing) {
16
                    $ingest = new Twitch\Ingest;
17
                    $ingest->setName($ing->name);
18
                    $ingest->setAvailability($ing->availability);
19
                    $ingest->setDefault($ing->default);
20
                    $ingest->setUrlTemplate($ing->url_template);
21
                    $ingests[] = $ingest;
22
                }
23
            }
24
        }
25
        return $ingests;
26
    }
27
}