GoogleConnectionFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 21
rs 10
ccs 10
cts 10
cp 1
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 13 1
1
<?php
2
/**
3
 * @author Tharanga Kothalawala <[email protected]>
4
 * @date 30-12-2018
5
 */
6
7
namespace TSK\SSO\ThirdParty\Google;
8
9
use Google_Service_Plus;
10
use TSK\SSO\ThirdParty\VendorConnection;
11
use TSK\SSO\ThirdParty\VendorConnectionFactory;
12
use TSK\SSO\Http\CurlRequest;
13
14
/**
15
 * @package TSK\SSO\ThirdParty\Google
16
 */
17
class GoogleConnectionFactory implements VendorConnectionFactory
18
{
19
    /**
20
     * @param string $clientId the client id which can be generated at the third party portal
21
     * @param string $clientSecret this can be found similar to the clientId
22
     * @param string $callbackUrl the url to callback after a third party auth attempt
23
     * @return VendorConnection
24
     */
25 1
    public function get($clientId, $clientSecret, $callbackUrl)
26
    {
27 1
        return new GoogleConnection(
28 1
            new GoogleApiConfiguration(
29 1
                $clientId,
30 1
                $clientSecret,
31
                array(
32 1
                    Google_Service_Plus::USERINFO_EMAIL,
33 1
                    Google_Service_Plus::USERINFO_PROFILE,
34 1
                ),
35
                $callbackUrl
36 1
            ),
37 1
            new CurlRequest()
38 1
        );
39
    }
40
}
41