Completed
Push — master ( 115731...0072c1 )
by Rafal
01:41
created

Session::getAccessToken()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
4
namespace SpotifyApiConnect\Application\SpotifyWebApiPhp;
5
6
use SpotifyApiConnect\Domain\Model\Config;
7
use \SpotifyWebAPI\Session as BaseSession;
8
9
class Session implements SessionInterface
10
{
11
    /**
12
     * @var BaseSession
13
     */
14
    private $baseSession;
15
16
    public function __construct(Config $config)
17
    {
18
        $this->baseSession = new BaseSession(
19
            $config->getClientId(),
20
            $config->getClientSecret(),
21
            $config->getRedirectUri()
22
        );
23
    }
24
25
    /**
26
     * @param array $options
27
     * @return string
28
     */
29
    public function getAuthorizeUrl(array $options = []) : string
30
    {
31
        return $this->baseSession->getAuthorizeUrl($options);
32
    }
33
34
    /**
35
     * @param string $authorizationCode
36
     * @return bool
37
     */
38
    public function requestAccessToken(string $authorizationCode) : bool
39
    {
40
        return $this->baseSession->requestAccessToken($authorizationCode);
41
    }
42
43
44
    /**
45
     * @return string
46
     */
47
    public function getAccessToken() : string
48
    {
49
        return $this->baseSession->getAccessToken();
50
    }
51
52
    /**
53
     * @return string
54
     */
55
    public function getRefreshToken() : string
56
    {
57
        return $this->baseSession->getRefreshToken();
58
    }
59
60
    /**
61
     * @param string $refreshToken
62
     * @return bool
63
     */
64
    public function refreshAccessToken(string $refreshToken) : bool
65
    {
66
        return $this->baseSession->refreshAccessToken($refreshToken);
67
    }
68
69
70
}