SlackAuthorizedUser::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
4
namespace AdamPaterson\OAuth2\Client\Provider;
5
6
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
7
8
class SlackAuthorizedUser implements ResourceOwnerInterface
9
{
10
    protected $response;
11
12
    /**
13
     * SlackAuthorizedUser constructor.
14
     *
15
     * @param $response
16
     */
17 6
    public function __construct(array $response)
18
    {
19 6
        $this->response = $response;
20 6
    }
21
22
    /**
23
     * Returns the identifier of the authorized resource owner.
24
     *
25
     * @return mixed
26
     */
27 6
    public function getId()
28
    {
29 6
        return $this->response['user_id'];
30
    }
31
32
    /**
33
     * Return all of the owner details available as an array.
34
     *
35
     * @return array
36
     */
37 3
    public function toArray()
38
    {
39 3
        return $this->response;
40
    }
41
42 3
    public function getUrl()
43
    {
44 3
        return $this->response['url'] ?: null;
45
    }
46
47 3
    public function getTeam()
48
    {
49 3
        return $this->response['team'] ?: null;
50
    }
51
52 3
    public function getUser()
53
    {
54 3
        return $this->response['user'] ?: null;
55
    }
56
57 3
    public function getTeamId()
58
    {
59 3
        return $this->response['team_id'] ?: null;
60
    }
61
62 3
    public function getUserId()
63
    {
64 3
        return $this->response['user_id'] ?: null;
65
    }
66
}
67