MovesResourceOwner::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace League\OAuth2\Client\Provider;
4
5
class MovesResourceOwner implements ResourceOwnerInterface
6
{
7
    /**
8
     * Domain
9
     *
10
     * @var string
11
     */
12
    protected $domain;
13
14
    /**
15
     * Raw response
16
     *
17
     * @var array
18
     */
19
    protected $response;
20
21
    /**
22
     * Creates new resource owner.
23
     *
24
     * @param array $response
25
     */
26 3
    public function __construct(array $response = [])
27
    {
28 3
        $this->response = $response;
29 3
    }
30
31
    /**
32
     * Get resource owner id
33
     *
34
     * @return string|null
35
     */
36 3
    public function getId()
37
    {
38 3
        return $this->response['userId'] ?: null;
39
    }
40
41
    /**
42
     * Get resource owner email
43
     *
44
     * @return string|null
45
     */
46 3
    public function getFirstDate()
47
    {
48 3
        return $this->response['profile']['firstDate'] ?: null;
49
    }
50
51
    /**
52
     * Get resource owner first name
53
     *
54
     * @return string|null
55
     */
56 3
    public function getCaloriesAvailable()
57
    {
58 3
        return $this->response['profile']['caloriesAvailable'] ?: null;
59
    }
60
61
    /**
62
     * Return all of the owner details available as an array.
63
     *
64
     * @return array
65
     */
66 3
    public function toArray()
67
    {
68 3
        return $this->response;
69
    }
70
}
71