MastodonResourceOwner   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 38
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getId() 0 3 1
A toArray() 0 3 1
A getName() 0 3 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: lrf141
5
 * Date: 18/08/30
6
 * Time: 2:26
7
 */
8
9
namespace Lrf141\OAuth2\Client\Provider;
10
11
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
12
use League\OAuth2\Client\Tool\ArrayAccessorTrait;
13
14
class MastodonResourceOwner implements ResourceOwnerInterface
15
{
16
17
    use ArrayAccessorTrait;
18
19
    /**
20
     * @var array
21
     */
22
    protected $response;
23
24 2
    public function __construct(array $response = array())
25
    {
26 2
        $this->response = $response;
27 2
    }
28
29
    /**
30
     * @return string
31
     */
32 2
    public function getId()
33
    {
34 2
        return $this->getValueByKey($this->response, 'id');
35
    }
36
37
    /**
38
     * @return string
39
     */
40 2
    public function getName()
41
    {
42 2
        return $this->getValueByKey($this->response, 'username');
43
    }
44
45
46
    /**
47
     * @return array
48
     */
49 2
    public function toArray()
50
    {
51 2
        return $this->response;
52
    }
53
}
54