PsnResourceOwner::toArray()   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 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Larabros\OAuth2\Client\Provider;
4
5
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
6
7
/**
8
 * Represents the owner of the access token.
9
 *
10
 * @package    OAuth2
11
 * @author     Hassan Khan <[email protected]>
12
 * @link       https://github.com/larabros/oauth2-psn
13
 * @license    MIT
14
 */
15
class PsnResourceOwner implements ResourceOwnerInterface
16
{
17
    /**
18
     * Raw response
19
     *
20
     * @var array
21
     */
22
    protected $response;
23
24
    /**
25
     * Creates new resource owner.
26
     *
27
     * @param array  $response
28
     */
29 2
    public function __construct(array $response = array())
30
    {
31 2
        $this->response = $response;
32 2
    }
33
34
    /**
35
     * Get resource owner id
36
     *
37
     * @return string|null
38
     */
39 2
    public function getId()
40
    {
41 2
        return $this->response['accountId'] ?: null;
42
    }
43
44
    /**
45
     * Get PSN ID
46
     *
47
     * @return string|null
48
     */
49 2
    public function getPsnId()
50
    {
51 2
        return $this->response['onlineId'] ?: null;
52
    }
53
54
    /**
55
     * Return all of the owner details available as an array.
56
     *
57
     * @return array
58
     */
59 2
    public function toArray()
60
    {
61 2
        return $this->response;
62
    }
63
}
64