Completed
Push — develop ( f9505c...0af02a )
by Gergely
04:43
created

ProviderApiClient   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 20
loc 20
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A make() 10 10 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/*
3
 * This file is part of the PayBreak/basket 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 View Code Duplication
class ProviderApiClient extends ApiClient
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
23
{
24
    /**
25
     * @author WN
26
     * @param string $baseUrl
27
     * @param string $token
28
     * @param LoggerInterface $logger
29
     * @return ProviderApiClient
30
     */
31 16
    public static function make($baseUrl, $token = '', LoggerInterface $logger = null)
32
    {
33 16
        $headers = [];
34
35 16
        if ($token != '') {
36 16
            $headers['Authorization'] = "ApiToken token=\"" . $token . "\"";
37 16
        }
38
39 16
        return new self(['base_uri' => $baseUrl], $logger, $headers);
40
    }
41
}
42