TokenResponse::isSuccessful()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 2
eloc 2
nc 2
nop 0
crap 6
1
<?php
2
3
namespace Omnipay\PaypalRest\Message;
4
5
/**
6
 * @author    Ivan Kerin <[email protected]>
7
 * @copyright 2014, Clippings Ltd.
8
 * @license   http://spdx.org/licenses/BSD-3-Clause
9
 */
10
class TokenResponse extends AbstractResponse
11
{
12
    /**
13
     * @return boolean
14
     */
15
    public function isSuccessful()
16
    {
17
        return (parent::isSuccessful() and isset($this->data['access_token']));
18
    }
19
20
    /**
21
     * @return string|null
22
     */
23
    public function getTokenType()
24
    {
25
        if (isset($this->data['token_type'])) {
26
            return $this->data['token_type'];
27
        }
28
    }
29
30
    /**
31
     * @return string|null
32
     */
33
    public function getAccessToken()
34
    {
35
        if (isset($this->data['access_token'])) {
36
            return $this->data['access_token'];
37
        }
38
    }
39
40
    /**
41
     * @return string|null
42
     */
43
    public function getAppId()
44
    {
45
        if (isset($this->data['app_id'])) {
46
            return $this->data['app_id'];
47
        }
48
    }
49
50
    /**
51
     * @return string|null
52
     */
53
    public function getExpiresIn()
54
    {
55
        if (isset($this->data['expires_in'])) {
56
            return $this->data['expires_in'];
57
        }
58
    }
59
60
    /**
61
     * @return integer|null
62
     */
63
    public function getExpires()
64
    {
65
        if (isset($this->data['expires_in'])) {
66
            return time() + $this->data['expires_in'];
67
        }
68
    }
69
}
70