Completed
Push — master ( acca1c...3f7868 )
by Дмитрий
03:40
created

AccessToken   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 51
ccs 14
cts 14
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 2
A getToken() 0 4 1
A setUid() 0 4 1
A getUserId() 0 4 1
1
<?php
2
/**
3
 * SocialConnect project
4
 * @author: Patsura Dmitry https://github.com/ovr <[email protected]>
5
 */
6
7
namespace SocialConnect\OAuth2;
8
9
use InvalidArgumentException;
10
use SocialConnect\Auth\AccessTokenInterface;
11
12
class AccessToken implements AccessTokenInterface
13
{
14
    /**
15
     * @var string
16
     */
17
    protected $token;
18
19
    /**
20
     * @var integer|null
21
     */
22
    protected $uid;
23
24
    /**
25
     * @param string $token
26
     * @throws \InvalidArgumentException
27
     */
28 4
    public function __construct($token)
29
    {
30 4
        if (!is_string($token)) {
31 1
            throw new InvalidArgumentException(
32 1
                '$token must be a string, passed: ' . gettype($token)
33 1
            );
34
        }
35
36 3
        $this->token = $token;
37 3
    }
38
39
    /**
40
     * @return string
41
     */
42 3
    public function getToken()
43
    {
44 3
        return $this->token;
45
    }
46
47
    /**
48
     * @param int|null $uid
49
     */
50 1
    public function setUid($uid)
51
    {
52 1
        $this->uid = $uid;
53 1
    }
54
55
    /**
56
     * @return integer
57
     */
58 1
    public function getUserId()
59
    {
60 1
        return $this->uid;
61
    }
62
}
63