Passed
Push — master ( 38cf41...2af3c5 )
by Hirofumi
02:50
created

BaseResourceOwner   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 47
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getId() 0 4 1
A getShopName() 0 4 1
A toArray() 0 4 1
1
<?php
2
3
namespace Shippinno\Base\OAuth2\Client\Provider;
4
5
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
6
7
class BaseResourceOwner implements ResourceOwnerInterface
8
{
9
    /**
10
     * Raw response
11
     *
12
     * @var array
13
     */
14
    protected $response;
15
16
    /**
17
     * @param array $response
18
     */
19 1
    public function __construct(array $response)
20
    {
21 1
        $this->response = $response;
22 1
    }
23
24
    /**
25
     * Returns the identifier of the authorized resource owner.
26
     *
27
     * @return string
28
     */
29 1
    public function getId()
30
    {
31 1
        return $this->response['user']['shop_id'];
32
    }
33
34
    /**
35
     * Returns the shop name.
36
     *
37
     * @return string
38
     */
39 1
    public function getShopName()
40
    {
41 1
        return $this->response['user']['shop_name'];
42
    }
43
44
    /**
45
     * Return all of the owner details available as an array.
46
     *
47
     * @return array
48
     */
49 1
    public function toArray()
50
    {
51 1
        return $this->response;
52
    }
53
}
54