YahooConnectionFactory::get()   A
last analyzed

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 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 9
rs 10
ccs 7
cts 7
cp 1
crap 1
1
<?php
2
/**
3
 * @author Tharanga Kothalawala <[email protected]>
4
 * @date 22-01-2019
5
 */
6
7
namespace TSK\SSO\ThirdParty\Yahoo;
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\Yahoo
15
 */
16
class YahooConnectionFactory implements VendorConnectionFactory
17
{
18
    /**
19
     * Returns a Yahoo Connection instance using given credentials. Visit the following link for credentials.
20
     * You must select 'Read/Write Public and Private' of 'Profiles (Social Directory)' API Permissions for this to work.
21
     * @see https://developer.yahoo.com/apps
22
     *
23
     * @param string $clientId the client id which can be generated at the third party portal
24
     * @param string $clientSecret this can be found similar to the clientId
25
     * @param string $callbackUrl the url to callback after a third party auth attempt
26
     * @return VendorConnection
27
     */
28 1
    public function get($clientId, $clientSecret, $callbackUrl)
29
    {
30 1
        return new YahooConnection(
31 1
            new YahooApiConfiguration(
32 1
                $clientId,
33 1
                $clientSecret,
34
                $callbackUrl
35 1
            ),
36 1
            new CurlRequest()
37 1
        );
38
    }
39
}
40