Completed
Pull Request — master (#37)
by Vitaliy
30:07 queued 26:47
created

Version::getVersion()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 14
ccs 0
cts 13
cp 0
rs 9.4285
cc 2
eloc 9
nc 2
nop 0
crap 6
1
<?php
2
3
namespace Xsolla\SDK;
4
5
use Xsolla\SDK\Exception\XsollaException;
6
7
class Version
8
{
9
    const VERSION = 'v2.6.0';
10
11
    /**
12
     * @throws XsollaException
13
     * @return string
14
     */
15
    public static function getVersion()
16
    {
17
        if (!extension_loaded('curl')) {
18
            throw new XsollaException('The PHP cURL extension must be installed to use Xsolla SDK for PHP.');
19
        }
20
        $curlVersion = curl_version();
21
22
        return sprintf(
23
            'xsolla-sdk-php/%s curl/%s PHP/%s',
24
            self::VERSION,
25
            $curlVersion['version'],
26
            PHP_VERSION
27
        );
28
    }
29
}
30