Completed
Push — master ( 50beb4...8d6a23 )
by Michał
02:12
created

Bitbucket::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 2
1
<?php namespace nyx\auth\id\identities;
2
3
// Internal dependencies
4
use nyx\auth\id\protocols\oauth2;
5
6
/**
7
 * Bitbucket Identity
8
 *
9
 * @package     Nyx\Auth
10
 * @version     0.1.0
11
 * @author      Michal Chojnacki <[email protected]>
12
 * @copyright   2012-2017 Nyx Dev Team
13
 * @link        https://github.com/unyx/nyx
14
 */
15
class Bitbucket extends oauth2\Identity
16
{
17
    /**
18
     * {@inheritDoc}
19
     */
20
    protected static $provider = oauth2\providers\Bitbucket::class;
21
22
    /**
23
     * @var string  The location bound to the Identity.
24
     */
25
    protected $location;
26
27
    /**
28
     * @var string  The website URL bound to the Identity.
29
     */
30
    protected $website;
31
32
    /**
33
     * @var string  The time the Identity was created at.
34
     */
35
    protected $createdAt;
36
37
    /**
38
     * {@inheritDoc}
39
     */
40
    public function __construct(oauth2\Token $token, array $data)
41
    {
42
        // Note: Bitbucket's UUIDs are wrapped by curly brackets - we are not
43
        // transforming that in any way.
44
        $this->id         = $data['uuid']         ?? null;
45
        $this->username   = $data['username']     ?? null;
46
        $this->name       = $data['display_name'] ?? null;
47
        $this->email      = $data['email']        ?? null;
48
        $this->location   = $data['location']     ?? null;
49
        $this->website    = $data['website']      ?? null;
50
        $this->createdAt  = $data['created_on']   ?? null;
51
52
        parent::__construct($token, $data);
53
    }
54
}
55