IpagClientMock   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 25
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getHttpClient() 0 3 1
A __construct() 0 17 1
1
<?php
2
3
namespace Ipag\Sdk\Mock;
4
5
use Ipag\Sdk\Core\Client;
6
use Ipag\Sdk\Core\IpagClient;
7
use Ipag\Sdk\Core\IpagEnvironment;
8
use Ipag\Sdk\Http\Client\BaseHttpClient;
9
use Ipag\Sdk\Http\Client\GuzzleHttpClient;
10
use Ipag\Sdk\IO\JsonSerializer;
11
12
final class IpagClientMock extends IpagClient
13
{
14
    public function __construct(string $apiID, string $apiKey, string $environment, string $version = '2', ?array $configGuzzle = [])
15
    {
16
        Client::__construct(
17
            new IpagEnvironment($environment),
18
            new GuzzleHttpClient(
19
                array_merge(
20
                    [
21
                        'headers' => [
22
                            'Authorization' => 'Basic ' . base64_encode("{$apiID}:{$apiKey}"),
23
                            'Content-Type' => 'application/json',
24
                            'x-api-version' => $version,
25
                        ],
26
                    ],
27
                    $configGuzzle
28
                )
29
            ),
30
            new JsonSerializer()
31
        );
32
    }
33
34
    public function getHttpClient(): BaseHttpClient
35
    {
36
        return $this->httpClient;
37
    }
38
39
}