Conditions | 5 |
Paths | 4 |
Total Lines | 23 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
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) { |
||
|
|||
14 | if (isset($response->token) == true) { |
||
15 | |||
16 | $root->setValid($response->token->valid); |
||
17 | |||
18 | if ($root->isValid() == true && isset($response->token->authorization) == true) { |
||
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 | } |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.