Session   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 11
c 1
b 0
f 0
dl 0
loc 61
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
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
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
}