ApiFactory::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 8
ccs 5
cts 5
cp 1
crap 1
rs 10
c 0
b 0
f 0
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