Games   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B listTopGames() 0 27 4
1
<?php
2
namespace Redbox\Twitch\Resource;
3
use Redbox\Twitch;
4
5
class Games extends ResourceAbstract {
6
7
    public function listTopGames($args = array())
8
    {
9
        $response = $this->call('listTopGames', $args);
10
11
        $games = [];
12
13
        if (is_object($response) === true && isset($response->top) === true)
14
        {
15
            foreach($response->top as $topgame) {
16
                $game = new Game();
17
                $game->setName($topgame->game->name);
18
                $game->setViewers($topgame->viewers);
19
                $game->setChannels($topgame->channels);
20
                $game->setBoxLarge($topgame->game->box->large);
21
                $game->setBoxMedium($topgame->game->box->medium);
22
                $game->setBoxSmall($topgame->game->box->small);
23
                $game->setBoxTemplate($topgame->game->box->template);
24
                $game->setLogoLarge($topgame->game->logo->large);
25
                $game->setLogoMedium($topgame->game->logo->medium);
26
                $game->setLogoSmall($topgame->game->logo->small);
27
                $game->setLogoTemplate($topgame->game->logo->template);
28
                $games[] = $game;
29
            }
30
        }
31
32
        return $games;
33
    }
34
}