Session::getAuthorizeUrl()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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