Completed
Push — master ( 8bc6ad...b2c48e )
by Vitaliy
16:26 queued 13:19
created

XsollaClientHelper::createXsollaClient()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 2
eloc 7
nc 2
nop 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