EcwidStoreProfile::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 1
cts 1
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Mugnate\OAuth2\Client\Provider;
4
5
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
6
use League\OAuth2\Client\Tool\ArrayAccessorTrait;
7
8
class EcwidStoreProfile implements ResourceOwnerInterface
9
{
10
    use ArrayAccessorTrait;
11
12
    /**
13
     * Raw response
14
     *
15
     * @var
16
     */
17
    protected $response;
18
19
    /**
20
     * Creates new resource owner.
21 9
     *
22
     * @param $response
23 9
     */
24 9
    public function __construct($response)
25
    {
26
        $this->response = $response;
27
    }
28
29
    /**
30
     * Returns the identifier of the store
31 6
     *
32
     * @return mixed
33 6
     */
34
    public function getId()
35
    {
36
        return $this->getValueByKey($this->response, 'generalInfo.storeId');
37
    }
38
39
40
    /**
41
     * Returns store owner email
42 6
     *
43
     * @return null
44 6
     */
45
    public function getEmail()
46
    {
47
        return $this->getValueByKey($this->response, 'account.accountEmail');
48
    }
49
50
51
    /**
52
     * Return all of the owner details available as an array.
53
     * Array get is RAW
54 6
     *
55
     * @return array
56 6
     */
57
    public function toArray()
58
    {
59
        return $this->response;
60
    }
61
}
62