Completed
Push — master ( b0169f...379291 )
by Tharanga
05:57
created

SpotifyConnectionFactory::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 3
dl 0
loc 9
rs 10
c 0
b 0
f 0
ccs 7
cts 7
cp 1
crap 1
1
<?php
2
/**
3
 * @author Tharanga Kothalawala <[email protected]>
4
 * @date 25-02-2019
5
 */
6
7
namespace TSK\SSO\ThirdParty\Spotify;
8
9
use TSK\SSO\Http\CurlRequest;
10
use TSK\SSO\ThirdParty\VendorConnection;
11
use TSK\SSO\ThirdParty\VendorConnectionFactory;
12
13
/**
14
 * @package TSK\SSO\ThirdParty\Spotify
15
 */
16
class SpotifyConnectionFactory implements VendorConnectionFactory
17
{
18
    /**
19
     * Returns a Spotify Connection instance using given credentials. Visit the following link for credentials.
20
     * @see https://developer.spotify.com/dashboard/applications
21
     *
22
     * @param string $clientId the client id which can be generated at the third party portal
23
     * @param string $clientSecret this can be found similar to the clientId
24
     * @param string $callbackUrl the url to callback after a third party auth attempt
25
     * @return VendorConnection
26
     */
27 1
    public function get($clientId, $clientSecret, $callbackUrl)
28
    {
29 1
        return new SpotifyConnection(
30 1
            new SpotifyApiConfiguration(
31 1
                $clientId,
32 1
                $clientSecret,
33
                $callbackUrl
34 1
            ),
35 1
            new CurlRequest()
36 1
        );
37
    }
38
}
39