JiraResourceOwner   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 69
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 3 1
A getName() 0 3 1
A __construct() 0 3 1
A getEmail() 0 3 1
A toArray() 0 3 1
A getNickname() 0 3 1
1
<?php
2
3
namespace Mrjoops\OAuth2\Client\Provider;
4
5
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
6
use League\OAuth2\Client\Tool\ArrayAccessorTrait;
7
8
class JiraResourceOwner implements ResourceOwnerInterface
9
{
10
    use ArrayAccessorTrait;
11
12
    /**
13
     * Raw response
14
     *
15
     * @var array
16
     */
17
    protected $response;
18
19
    /**
20
     * Creates new resource owner.
21
     *
22
     * @param array  $response
23
     */
24 15
    public function __construct(array $response = [])
25
    {
26 15
        $this->response = $response;
27 15
    }
28
    
29
    /**
30
     * Get resource owner email
31
     *
32
     * @return string|null
33
     */
34 6
    public function getEmail()
35
    {
36 6
        return $this->getValueByKey($this->response, 'emailAddress');
37
    }
38
    
39
    /**
40
     * Get resource owner id
41
     *
42
     * @return string|null
43
     */
44 6
    public function getId()
45
    {
46 6
        return $this->getValueByKey($this->response, 'accountId');
47
    }
48
    
49
    /**
50
     * Get resource owner name
51
     *
52
     * @return string|null
53
     */
54 6
    public function getName()
55
    {
56 6
        return $this->getValueByKey($this->response, 'displayName');
57
    }
58
    
59
    /**
60
     * Get resource owner nickname
61
     *
62
     * @return string|null
63
     */
64 6
    public function getNickname()
65
    {
66 6
        return $this->getValueByKey($this->response, 'name');
67
    }
68
69
    /**
70
     * Return all of the owner details available as an array.
71
     *
72
     * @return array
73
     */
74 3
    public function toArray()
75
    {
76 3
        return $this->response;
77
    }
78
}
79