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

AccessToken::setUid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 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