BaseResourceOwner::getId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Shippinno\Base\OAuth2\Client\Provider;
4
5
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
6
use League\OAuth2\Client\Tool\ArrayAccessorTrait;
7
8
class BaseResourceOwner implements ResourceOwnerInterface
9
{
10
    use ArrayAccessorTrait;
11
12
    /**
13
     * Raw response
14
     *
15
     * @var array
16
     */
17
    protected $response;
18
19
    /**
20
     * @param array $response
21
     */
22 1
    public function __construct(array $response)
23
    {
24 1
        $this->response = $response;
25 1
    }
26
27
    /**
28
     * Returns the identifier of the authorized resource owner.
29
     *
30
     * @return string
31
     */
32 1
    public function getId()
33
    {
34 1
        return $this->getValueByKey($this->response, 'user.shop_id');
35
    }
36
37
    /**
38
     * Returns the shop name.
39
     *
40
     * @return string
41
     */
42 1
    public function getShopName()
43
    {
44 1
        return $this->getValueByKey($this->response, 'user.shop_name');
45
    }
46
47
    /**
48
     * Return all of the owner details available as an array.
49
     *
50
     * @return array
51
     */
52 1
    public function toArray()
53
    {
54 1
        return $this->response;
55
    }
56
}
57