ConfigFacade   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 29
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

2 Methods

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