Completed
Pull Request — master (#101)
by Hiraku
05:27
created

ConfigFacade   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 92.86%

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 5
c 3
b 1
f 0
lcom 0
cbo 0
dl 0
loc 29
rs 10
ccs 13
cts 14
cp 0.9286

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getUserAgent() 0 15 3
A getPHPVersion() 0 7 2
1
<?php
2
namespace Hirak\Prestissimo;
3
4
use Composer\Composer;
5
use Composer\Config;
6
7
class ConfigFacade
8
{
9 3
    public static function getUserAgent()
10
    {
11 3
        static $ua;
12 3
        if ($ua) {
13 2
            return $ua;
14
        }
15
16 1
        return $ua = sprintf(
17
            'Composer/%s (%s; %s; %s)',
18
            Composer::VERSION === '@package_version@' ? 'source' : Composer::VERSION,
19 1
            php_uname('s'),
20
            php_uname('r'),
21
            self::getPHPVersion()
22
        );
23 1
    }
24 1
25 1
    /**
26 1
     * @codeCoverageIgnore
27 1
     */
28
    private static function getPHPVersion()
29
    {
30
        if (defined('HHVM_VERSION')) {
31
            return 'HHVM ' . HHVM_VERSION;
32 1
        }
33
        return 'PHP ' . PHP_VERSION;
34
    }
35
}
36