Completed
Push — develop ( 78995e...bfd409 )
by Risan Bagja
01:42
created

OAuth1Factory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 10

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 10
dl 0
loc 25
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 16 1
1
<?php
2
3
namespace Risan\OAuth1;
4
5
use Risan\OAuth1\Request\UriParser;
6
use Risan\OAuth1\Config\ConfigFactory;
7
use Risan\OAuth1\Request\NonceGenerator;
8
use Risan\OAuth1\Request\RequestFactory;
9
use Risan\OAuth1\Signature\HmacSha1Signer;
10
use Risan\OAuth1\Request\ProtocolParameter;
11
use Risan\OAuth1\Request\AuthorizationHeader;
12
use Risan\OAuth1\Credentials\CredentialsFactory;
13
14
class OAuth1Factory
15
{
16
    /**
17
     * Create the new OAuth1Interface instance.
18
     *
19
     * @param  array  $config
20
     * @return \Risan\OAuth1\OAuth1Interface
21
     */
22 1
    public static function create(array $config)
23
    {
24 1
        $configFactory = new ConfigFactory;
25
26 1
        $protocolParameter = new ProtocolParameter(
27 1
            $configFactory->createFromArray($config),
28 1
            new HmacSha1Signer,
29 1
            new NonceGenerator
30
        );
31
32 1
        $authorizationHeader = new AuthorizationHeader($protocolParameter);
33
34 1
        $requestFactory = new RequestFactory($authorizationHeader, new UriParser);
35
36 1
        return new OAuth1(new HttpClient, $requestFactory, new CredentialsFactory);
37
    }
38
}
39