Completed
Pull Request — master (#37)
by Vitaliy
19:06 queued 09:04
created

XsollaClientHelper   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 26
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getXsollaClient() 0 8 2
A createXsollaClient() 0 12 2
1
<?php
2
3
namespace Xsolla\SDK\Tests\Helper;
4
5
use Xsolla\SDK\API\XsollaClient;
6
7
class XsollaClientHelper
8
{
9
    private static $xsollaClient;
10
11
    public static function getXsollaClient($merchantId, $apiKey)
12
    {
13
        if (!self::$xsollaClient) {
14
            self::$xsollaClient = self::createXsollaClient($merchantId, $apiKey);
15
        }
16
17
        return self::$xsollaClient;
18
    }
19
20
    private static function createXsollaClient($merchantId, $apiKey)
21
    {
22
        $xsollaClient = XsollaClient::factory(array(
23
            'merchant_id' => $merchantId,
24
            'api_key' => $apiKey,
25
        ));
26
        if (DebugHelper::isDebug()) {
27
            DebugHelper::addDebugOptionsToHttpClient($xsollaClient);
28
        }
29
30
        return $xsollaClient;
31
    }
32
}
33