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

Session   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 6
dl 0
loc 58
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getAuthorizeUrl() 0 3 1
A getAccessToken() 0 3 1
A requestAccessToken() 0 3 1
A getRefreshToken() 0 3 1
A refreshAccessToken() 0 3 1
A __construct() 0 6 1
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
}