Completed
Push — master ( 9d06c6...846137 )
by Steven
03:12
created

LinkedInAccessToken::__construct()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 8
cts 8
cp 1
rs 9.8666
c 0
b 0
f 0
cc 3
nc 3
nop 1
crap 3
1
<?php
2
3
namespace League\OAuth2\Client\Token;
4
5
class LinkedInAccessToken extends AccessToken
6
{
7
    /**
8
     * @var int
9
     */
10
    protected $refreshTokenExpires;
11
12
    /**
13
     * Constructs an access token.
14
     *
15
     * @param array $options An array of options returned by the service provider
16
     *     in the access token request. The `access_token` option is required.
17
     * @throws InvalidArgumentException if `access_token` is not provided in `$options`.
18
     */
19 5
    public function __construct(array $options = [])
20
    {
21 5
        parent::__construct($options);
22
23 5
        if (isset($options['refresh_token_expires_in'])) {
24 1
            $expires = $options['refresh_token_expires_in'];
25 1
            if (!$this->isExpirationTimestamp($expires)) {
26 1
                $expires += time();
27
            }
28 1
            $this->refreshTokenExpires = $expires;
29
        }
30 5
    }
31
32
    /**
33
     * Returns the refresh token expiration timestamp, if defined.
34
     *
35
     * @return integer|null
36
     */
37 1
    public function getRefreshTokenExpires()
38
    {
39 1
        return $this->refreshTokenExpires;
40
    }
41
}
42