BitfinexClient   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A public() 0 4 1
A createPublicClient() 0 4 1
A getPublicClient() 0 4 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Codenixsv\BitfinexApi;
6
7
use Codenixsv\BitfinexApi\Api\PublicApi;
8
use GuzzleHttp\Client;
9
10
class BitfinexClient
11
{
12
    private const BASE_URI = 'https://api-pub.bitfinex.com';
13
14
    /** @var Client */
15
    private $publicClient;
16
17
    /**
18
     * @return PublicApi
19
     */
20 1
    public function public(): PublicApi
21
    {
22 1
        return new PublicApi($this->getPublicClient());
23
    }
24
25
    /**
26
     * @return Client
27
     */
28 1
    private function createPublicClient(): Client
29
    {
30 1
        return new Client(['base_uri' => self::BASE_URI]);
31
    }
32
33
    /**
34
     * @return Client
35
     */
36 1
    private function getPublicClient(): Client
37
    {
38 1
        return $this->publicClient ?: $this->createPublicClient();
39
    }
40
}
41