Completed
Push — master ( 4b89b9...dd9abc )
by Jens
10:35
created

Token::setTtl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 * @created: 22.01.15, 11:41
5
 */
6
7
namespace Commercetools\Core\Client\OAuth;
8
9
/**
10
 * @package Commercetools\Core\OAuth
11
 */
12
class Token
13
{
14
    /**
15
     * @var string
16
     */
17
    protected $token;
18
19
    /**
20
     * @var \DateTime
21
     */
22
    protected $validTo;
23
24
    /**
25
     * @var int
26
     */
27
    protected $ttl;
28
29
    /**
30
     * @var string
31
     */
32
    protected $scope;
33
34
    /**
35
     * @var string
36
     */
37
    protected $refreshToken;
38
39 308
    public function __construct($token = null, $ttl = null, $scope = null)
40
    {
41 308
        $this->setToken($token)->setTtl($ttl)->setScope($scope);
42 308
    }
43
44
    /**
45
     * @return string
46
     */
47 306
    public function getToken()
48
    {
49 306
        return $this->token;
50
    }
51
52
    /**
53
     * @param string $token
54
     * @return $this
55
     */
56 308
    public function setToken($token)
57
    {
58 308
        $this->token = $token;
59
60 308
        return $this;
61
    }
62
63
    /**
64
     * @return \DateTime
65
     */
66 1
    public function getValidTo()
67
    {
68 1
        return $this->validTo;
69
    }
70
71
    /**
72
     * @param \DateTime $validTo
73
     * @return $this
74
     */
75 12
    public function setValidTo(\DateTime $validTo)
76
    {
77 12
        $this->validTo = $validTo;
78
79 12
        return $this;
80
    }
81
82
    /**
83
     * @return int
84
     */
85 12
    public function getTtl()
86
    {
87 12
        return $this->ttl;
88
    }
89
90
    /**
91
     * @param int $ttl
92
     * @return $this
93
     */
94 308
    public function setTtl($ttl)
95
    {
96 308
        $this->ttl = $ttl;
97
98 308
        return $this;
99
    }
100
101
    /**
102
     * @return string
103
     */
104 3
    public function getScope()
105
    {
106 3
        return $this->scope;
107
    }
108
109
    /**
110
     * @param string $scope
111
     * @return $this
112
     */
113 308
    public function setScope($scope)
114
    {
115 308
        $this->scope = $scope;
116
117 308
        return $this;
118
    }
119
120
    /**
121
     * @return string
122
     */
123 4
    public function getRefreshToken()
124
    {
125 4
        return $this->refreshToken;
126
    }
127
128
    /**
129
     * @param string $refreshToken
130
     * @return $this
131
     */
132 4
    public function setRefreshToken($refreshToken)
133
    {
134 4
        $this->refreshToken = $refreshToken;
135
136 4
        return $this;
137
    }
138
}
139