Completed
Push — master ( a054a0...cffdc3 )
by Johnny
02:13
created

Root   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
c 2
b 0
f 0
lcom 0
cbo 3
dl 0
loc 26
ccs 0
cts 19
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B getRoot() 0 23 5
1
<?php
2
namespace Redbox\Twitch\Resource;
3
use Redbox\Twitch;
4
5
class Root extends ResourceAbstract {
6
7
    public function getRoot($args = array())
8
    {
9
        $response = $this->call('get', $args);
10
11
        $root = new Twitch\Root;
12
13
        if (is_object($response) == true) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
14
            if (isset($response->token) == true) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
15
16
                $root->setValid($response->token->valid);
17
18
                if ($root->isValid() == true && isset($response->token->authorization) == true) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
19
                    $root->setUserName($response->token->user_name);
20
                    $authorization = new Twitch\Authorization;
21
                    $authorization->setScopes($response->token->authorization->scopes);
22
                    $authorization->setCreatedAt($response->token->authorization->created_at);
23
                    $authorization->setUpdatedAt($response->token->authorization->created_at);
24
                    $root->setAuthorization($authorization);
25
                }
26
            }
27
        }
28
        return $root;
29
    }
30
}