LinkedInConnectionFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 6
c 2
b 0
f 0
dl 0
loc 26
rs 10
ccs 7
cts 7
cp 1
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A get() 0 5 1
1
<?php
2
/**
3
 * @author Tharanga Kothalawala <[email protected]>
4
 * @date 31-12-2018
5
 */
6
7
namespace TSK\SSO\ThirdParty\LinkedIn;
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\LinkedIn
15
 */
16
class LinkedInConnectionFactory implements VendorConnectionFactory
17
{
18
    /**
19
     * @var string
20
     */
21
    private $permissions;
22
23
    /**
24
     * @param string $permissions
25
     */
26 1
    public function __construct($permissions = 'r_basicprofile,r_emailaddress')
27
    {
28 1
        $this->permissions = $permissions;
29 1
    }
30
31
    /**
32
     * @param string $clientId the client id which can be generated at the third party portal
33
     * @param string $clientSecret this can be found similar to the clientId
34
     * @param string $callbackUrl the url to callback after a third party auth attempt
35
     * @return VendorConnection
36
     */
37 1
    public function get($clientId, $clientSecret, $callbackUrl)
38
    {
39 1
        return new LinkedInConnection(
40 1
            new LinkedInApiConfiguration($clientId, $clientSecret, $this->permissions, $callbackUrl),
41 1
            new CurlRequest()
42 1
        );
43
    }
44
}
45