ProviderApiClient::make()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 3
crap 2
1
<?php
2
/*
3
 * This file is part of the PayBreak/paybreak-sdk-php package.
4
 *
5
 * (c) PayBreak <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace PayBreak\Sdk\ApiClient;
12
13
use PayBreak\ApiClient\ApiClient;
14
use Psr\Log\LoggerInterface;
15
16
/**
17
 * Class ProviderApiClient
18
 *
19
 * @author WN
20
 * @package PayBreak\Sdk\ApiClient
21
 */
22
class ProviderApiClient extends ApiClient
23
{
24
    /**
25
     * @author WN
26
     * @param string $baseUrl
27
     * @param string $token
28
     * @param LoggerInterface $logger
29
     * @return ProviderApiClient
30
     */
31 8
    public static function make($baseUrl, $token = '', LoggerInterface $logger = null)
32
    {
33 8
        $headers = [];
34
35 8
        if ($token != '') {
36 8
            $headers['Authorization'] = "ApiToken token=\"" . $token . "\"";
37 8
        }
38
39 8
        return new self(['base_uri' => $baseUrl], $logger, $headers);
40
    }
41
}
42