ApiFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 18
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 8 1
1
<?php
2
3
/*
4
 * This file is part of the zibios/wrike-php-sdk package.
5
 *
6
 * (c) Zbigniew Ślązak
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Zibios\WrikePhpSdk;
13
14
use Zibios\WrikePhpGuzzle\ClientFactory;
15
use Zibios\WrikePhpGuzzle\Transformer\ApiException\GuzzleTransformer;
16
use Zibios\WrikePhpLibrary\Api;
17
use Zibios\WrikePhpLibrary\Transformer\Response\Psr\ArrayBodyTransformer;
18
19
/**
20
 * Api Factory.
21
 */
22
class ApiFactory
23
{
24
    /**
25
     * @param string|null $accessToken
26
     *
27
     * @throws \InvalidArgumentException
28
     *
29
     * @return Api
30
     */
31 5
    public static function create($accessToken = '')
32
    {
33 5
        $client = ClientFactory::create();
34 5
        $responseTransformer = new ArrayBodyTransformer();
35 5
        $apiExceptionTransformer = new GuzzleTransformer();
36
37 5
        return new Api($client, $responseTransformer, $apiExceptionTransformer, $accessToken);
38
    }
39
}
40