LinkedInAccessToken   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 37
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 3
A getRefreshTokenExpires() 0 4 1
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 7
    public function __construct(array $options = [])
20
    {
21 7
        parent::__construct($options);
22
23 7
        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 7
    }
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