Completed
Branch develop (6fd611)
by Quentin
02:32
created

AccessToken::getExpireIn()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Majora\Component\OAuth\Entity;
4
5
use Majora\Component\OAuth\Model\AccessTokenInterface;
6
use Majora\Component\OAuth\Model\AccountInterface;
7
use Majora\Component\OAuth\Model\ApplicationInterface;
8
use Majora\Component\OAuth\Model\RefreshTokenInterface;
9
use Majora\Framework\Model\CollectionableInterface;
10
use Majora\Framework\Model\CollectionableTrait;
11
use Majora\Framework\Serializer\Model\SerializableTrait;
12
13
/**
14
 * Access token class.
15
 */
16
class AccessToken extends Token implements AccessTokenInterface, CollectionableInterface
17
{
18
    use CollectionableTrait, SerializableTrait;
19
20
    /**
21
     * @var RefreshTokenInterface
22
     */
23
    protected $refreshToken;
24
25
    /**
26
     * @see AccessTokenInterface::__construct()
27
     */
28 12
    public function __construct(
29
        ApplicationInterface $application,
30
        AccountInterface $account = null,
31
        $expireIn = AccessTokenInterface::DEFAULT_TTL,
32
        \DateTime $expireAt = null,
33
        $hash = null,
34
        RefreshTokenInterface $refreshToken = null
35
    ) {
36 12
        parent::__construct($application, $account, $expireIn, $expireAt, $hash);
37 12
        $this->refreshToken = $refreshToken;
38 12
    }
39
40
    /**
41
     * @see AccessTokenInterface::getRefreshToken()
42
     */
43 12
    public function getRefreshToken()
44
    {
45 12
        return $this->refreshToken;
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public static function getScopes()
52
    {
53
        return array(
54
            'default' => array('id', 'hash', 'expire_in', 'refresh_token', 'application@id', 'account@id'),
55
        );
56
    }
57
}
58