Passed
Push — master ( 1ace75...f3dc19 )
by Zbigniew
13:26
created

ApiFactory::createForBearerToken()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
crap 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 $bearerToken
26
     *
27
     * @throws \InvalidArgumentException
28
     *
29 5
     * @return Api
30
     */
31 5
    public static function create($bearerToken = '')
32 5
    {
33 5
        $client = ClientFactory::create();
34
        $responseTransformer = new ArrayBodyTransformer();
35 5
        $apiExceptionTransformer = new GuzzleTransformer();
36
37
        return new Api($client, $responseTransformer, $apiExceptionTransformer, $bearerToken);
38
    }
39
}
40