Teams   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 42
ccs 0
cts 34
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
B listTeams() 0 23 4
A getTeamByName() 0 15 1
1
<?php
2
namespace Redbox\Twitch\Resource;
3
use Redbox\Twitch;
4
5
class Teams extends ResourceAbstract
6
{
7
    public function listTeams($args = [])
8
    {
9
        $response = $this->call('listTeams', $args);
10
11
        $teams = [];
12
13
        if (is_object($response) === true) {
14
            if (isset($response->teams)) {
15
                foreach($response->teams as $tm) {
16
                    $team = new Twitch\Team;
17
                    $team->setName($tm->name);
18
                    $team->setInfo($tm->info);
19
                    $team->setDisplayName($tm->display_name);
20
                    $team->setCreatedAt($tm->created_at);
21
                    $team->setUpdatedAt($tm->updated_at);
22
                    $team->setBackground($tm->background);
23
                    $team->setLogo($tm->logo);
24
                    $teams[] = $team;
25
                }
26
            }
27
        }
28
        return $teams;
29
    }
30
31
    public function getTeamByName($args = [])
32
    {
33
34
        $response = $this->call('getTeamByName', $args);
35
36
        $team = new Twitch\Team;
37
        $team->setName($response->name);
38
        $team->setInfo($response->info);
39
        $team->setDisplayName($response->display_name);
40
        $team->setCreatedAt($response->created_at);
41
        $team->setUpdatedAt($response->updated_at);
42
        $team->setBackground($response->background);
43
        $team->setLogo($response->logo);
44
        return $team;
45
    }
46
}